How can I send the MATLAB data(using loop) to excel???

1 回表示 (過去 30 日間)
연승 김
연승 김 2021 年 1 月 26 日
コメント済み: 연승 김 2021 年 1 月 26 日
Hello. I have a touble.
I can send the MATLAB single data to excel. I studied it by this website.
But, if when the data value changes because of the loop statement,
and then how can I accumulate the all data??
For example,
for i = 1:9
A1 = randi([1 30]);
A2 = randi([1 30]);
A3 = randi([1 30]);
i = i+1
According the loop runs, the value of A1, A2, A3 change.
I want to get an excel file like figure below, because I want to conduct sensitivity analysis by using the accumulated data.
If another method to conduct sensitivity analysis by MATLAB,
please, give me some advices.


Timo Dietz
Timo Dietz 2021 年 1 月 26 日
rndMatrix = zeros(9, 4); % preallocation
for i = 1:9
rndMatrix(i, 1) = i; % i
rndMatrix(i, 2) = randi([1 30]); % A1
rndMatrix(i, 3) = randi([1 30]); % A2
rndMatrix(i, 4) = randi([1 30]); % A3
Now, rndMAtrix contains all data.
  1 件のコメント
연승 김
연승 김 2021 年 1 月 26 日
Wow. it works very well!!! Thank you!!


その他の回答 (0 件)


Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by