How do I substract like variables from each other
2 ビュー (過去 30 日間)
古いコメントを表示

3 件のコメント
Zahrah Walid
2022 年 12 月 2 日
I guess this is somehow similar to your problem: https://www.mathworks.com/matlabcentral/answers/18717-time-difference-between-two-sets-of-times-in-hrs-mins-and-seconds-gui-if-possible
回答 (2 件)
Arif Hoq
2022 年 12 月 2 日
one approach:
a=readmatrix("Book1.xlsx");
b= datetime(a,'ConvertFrom','excel');
% b(:,3)=b(:,2);
for i=1:size(b,1)-1
if b(i,1)==b(i+1,1)
c(i)=b(i+1,2)-b(i,2);
end
end
output=c'
0 件のコメント
Voss
2022 年 12 月 3 日
a = readmatrix("Book1.xlsx");
b = datetime(a(:,2),'ConvertFrom','excel');
N = size(a,1);
c = duration(NaN(N,3));
for i = 1:N-1
if a(i,1) == a(i+1,1)
c(i+1) = b(i+1)-b(i);
end
end
disp(c);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!