Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Substract only higher then a limit? Please find the example program below.
1 回表示 (過去 30 日間)
古いコメントを表示
Suppose
dataI = [100;200;300;100;200;300];
limit = 150;
if any(dataI >= limit)
disp('There is at least one value above the limit.')
DataI_with_Neg = dataI - 100; %% Here I want to sub 100 from all the values which are higher than limit = 150 and get new data after sub%%
else
disp('All values are below the limit.')
end
0 件のコメント
回答 (1 件)
madhan ravi
2019 年 2 月 12 日
編集済み: madhan ravi
2019 年 2 月 12 日
https://blogs.mathworks.com/loren/2013/02/20/logical-indexing-multiple-conditions/ - this should get you started
DataI_with_Neg = dataI(dataI > limit) - 100;
% ^^^^^^^^^^^^^^^--- add this (datas which are higher than 150)
6 件のコメント
madhan ravi
2019 年 2 月 12 日
編集済み: madhan ravi
2019 年 2 月 12 日
Ah thank you John D'Errico & Stephen Cobeldick now it's clear what the OP wants.
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!