loop for subtracting values
2 ビュー (過去 30 日間)
古いコメントを表示
I am trying to get subtraction from the strain data of all channels to the strain data of channel 1. But the following codes give me the subtraction only from channel 2 to channel 1. I don't get the other channels. Please help me to correct the codes.
data1 = Dasdata.Strain(channels,1)';
for i = 2:53
data2 = Dasdata.Strain(channels,i);
y = data2-data1;
plot(y)
end
0 件のコメント
採用された回答
Walter Roberson
2021 年 11 月 18 日
data1 = Dasdata.Strain(channels,1)';
for i = 2:53
data2 = Dasdata.Strain(channels,i);
y = data2-data1;
plot(y, 'DisplayName', "channel " + i);
hold on
end
hold off
legend show
2 件のコメント
Steven Lord
2021 年 11 月 29 日
Use implicit expansion.
A = randi(10, 5, 10) % sample data between 1 and 10
B = A - A(:, 1)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Stress and Strain についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!