Create a simple table from using data from other table and an Iteration loop
이전 댓글 표시
Dear all,
I am very frustrated trying to create a very basic thing in Matlab for the past 4 hours with no success.
i have a table named time = [0;1;2;3;4;5;6;7;8;9;10;12;14;16;18;20;22;25;28;30];
I am trying to make a second table dt that will be the difference of the current minus the previous time.
dt = [1;1;1;1;1;1;1;1;1;1;1;2;2;2;2;2;2;3;2] using the following loop:
for i=2:20
k=time(i)-time(i-1);
dt(i-1)= k;
end
but I get the following error:
Subscripting a table using linear indexing (one subscript) or multidimensional indexing (three or more subscripts) is not supported. Use a row
subscript and a variable subscript.
Please help!!!
BR
댓글 수: 1
Stephen23
2019년 4월 29일
>> time = [0;1;2;3;4;5;6;7;8;9;10;12;14;16;18;20;22;25;28;30];
>> diff(time)
ans =
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
3
3
2
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!