Subtraction in For Loop not executing
이전 댓글 표시
So I have a Cell called "Messdaten" which has N furhter Cells with 6 nx2 doubles where the first column is the time and the second is my data.
I am trying to apend my data right after each other as the times of the N Cells are not sqeuntial - theres gaps.
Therefore I try to make my time_j(1) = 0 by substracting time_j(1) from the array time_j.
However this line of code does not execute.
for i=1:N
SW_uf = Messdaten{:,i};
for j = 1:length(SW_uf)
t_vs_phi_i = SW_uf{:,j};
time_j = t_vs_phi_i(:,1);
phi_i = t_vs_phi_i(:,2);
time_j = time_j - time_j(1);
time_j = time_j - time_j(1);
for m = 1:LW(i)
phi_i_bl = phi_i(1:length(phi_i) - 1);
time_i_bl = time_j(1:length(time_j) - 1) + t_l(j);
t_l(j) = time_i_bl(length(time_i_bl));
end
VD_j{j} = [time_i_bl phi_i_bl];
phi_i_bl = [];
time_i_bl = [];
end
Schwingungen{i} = [VD_j];
end
Heres an example of what my current results look like in a graph. It should start at zero and the second batch periods should start right after the first.

Thank you in advance!
답변 (1개)
Walter Roberson
2022년 5월 15일
for m = 1:LW(i)
phi_i_bl = phi_i(1:length(phi_i) - 1);
time_i_bl = time_j(1:length(time_j) - 1) + t_l(j);
t_l(j) = time_i_bl(length(time_i_bl));
end
for m but assign indexed at j??
By the way, consider using the index named "n", as in time_i_bl(end-1) instead of (length(time_i_bl)-1)
카테고리
도움말 센터 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!