Cells detect and Cells numers in array
1 view (last 30 days)
Show older comments
Krasimir Terziev
on 3 Aug 2021
Commented: Star Strider
on 5 Aug 2021
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 !
0 Comments
Accepted Answer
Star Strider
on 3 Aug 2021
M1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/701747/1.xlsx')
time_desired = [0, 10, 60, 90, 120, 180]; % Define As Desired
interpolated_signal = interp1(M1(:,1), M1(:,2), time_desired.', 'linear')
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
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!