for x=1:0.5:20
how can store the value for this type of for loop.

6 件のコメント

madhan ravi
madhan ravi 2018 年 11 月 27 日
編集済み: madhan ravi 2018 年 11 月 27 日
If you show the calculation we can vectorize it even without a loop if there is a possibility.
wong loong
wong loong 2018 年 11 月 27 日
for i=1:0.5:20
Base =(BaseValue.inputSingleScan-1.63)*(327/10)*100;
Top = (TopValue.inputSingleScan-1.63)*(327/10)*100;
PI1 = abs(Top - Base);
this is calculation.
madhan ravi
madhan ravi 2018 年 11 月 27 日
BaseValue.inputSingleScan ? provide the datas
wong loong
wong loong 2018 年 11 月 27 日
data scan from sensor.
madhan ravi
madhan ravi 2018 年 11 月 27 日
is it stored or live data?
wong loong
wong loong 2018 年 11 月 27 日
live data...i want store the data every time loop...then find out the maximun value.

サインインしてコメントする。

 採用された回答

madhan ravi
madhan ravi 2018 年 11 月 27 日
編集済み: madhan ravi 2018 年 11 月 27 日

0 投票

EDITED
x=1:0.5:20;
n=numel(x);
Base=cell(1,n); % PRE-ALLOCATION
Top=cell(1,n);
PI1=cell(1,n);
for i=1:n
Base{i} =(BaseValue.inputSingleScan-1.63)*(327/10)*100;
Top{i} = (TopValue.inputSingleScan-1.63)*(327/10)*100;
PI1{i} = abs([Top{i}] - [Base{i}]);
end
values=[PI1{:}];
max_value=max(values);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2018 年 11 月 27 日

編集済み:

2018 年 11 月 27 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by