Cells detect and Cells numers in array

1 Ansicht (letzte 30 Tage)
Krasimir Terziev
Krasimir Terziev am 3 Aug. 2021
Kommentiert: Star Strider am 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 !

Akzeptierte Antwort

Star Strider
Star Strider am 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 Kommentare
Krasimir Terziev
Krasimir Terziev am 5 Aug. 2021
Bearbeitet: Krasimir Terziev am 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 am 5 Aug. 2021
Great!
As always, my pleasure!
You, too!
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by