Create an excel sheet from data stored in variable used in a for loop

1 回表示 (過去 30 日間)
anshuman mishra
anshuman mishra 2019 年 7 月 31 日
回答済み: Bob Thompson 2019 年 7 月 31 日
given loop:
input value = c
for m=0:1:c-1
if( some condition )
//some operation;
j=1;
else
j=0;
end
end
I want to store value of j for every iteration from 0 to c-1 in an excel sheet like lets say for c=5,my xls sheet should look some what like this:
// this is just a reference
1
0
0
1
0

採用された回答

Bob Thompson
Bob Thompson 2019 年 7 月 31 日
From what you've posted, which is a bit vague, it seems like all you need to do is index your results and then use xlswrite to print the results.
for m = 1: c-1
...
j(m) = 1;
else
j(m) = 0;
end
end
xlswrite('mydata.xlsx',j)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by