Cells detect and Cells numers in array

1 view (last 30 days)
Hello,
I've got an array out of a scope simulation in simulink. In this array i've got the time in 1st column and the value of the signal in the 2nd. My max step size is 10sec. so the time data is from 0 to 1000 per 10 ( there is more values in time column but thats not the problem). I want to know what is the value of B1(the cell location as it is in excel) if A1=0. e.g. what is the value of the signal when time is 0 ? Then what is the value when the time is 60 sec and so on.
Thanks in advance !

Accepted Answer

Star Strider
Star Strider on 3 Aug 2021
M1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/701747/1.xlsx')
M1 = 65926×2
0 232.6044 0.0000 232.6044 0.0000 232.6044 0.0000 232.6044 0.0000 232.6044 0.0000 232.6044 0.0001 232.6044 0.0003 232.6044 0.0015 232.6044 0.0074 232.6044
time_desired = [0, 10, 60, 90, 120, 180]; % Define As Desired
interpolated_signal = interp1(M1(:,1), M1(:,2), time_desired.', 'linear')
interpolated_signal = 6×1
232.6044 232.6119 232.6492 232.6716 232.6940 232.7388
figure
plot(M1(:,1), M1(:,2),'-b')
hold on
plot(time_desired, interpolated_signal, 'rs')
hold off
grid
xlabel('time')
ylabel('signal')
xlim([0 200]) % Restrict Axis View To Sho9w Detail
Make necessary changes to get the result you want.
.
  7 Comments
Krasimir Terziev
Krasimir Terziev on 5 Aug 2021
Edited: Krasimir Terziev on 5 Aug 2021
That was what i looking for !
Thank you so much! I can't describe how greatful I am.
Wish u best of luck and stay save!
Star Strider
Star Strider on 5 Aug 2021
Great!
As always, my pleasure!
You, too!
.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!