フィルターのクリア

how to save for loop variable output data in csv file?

3 ビュー (過去 30 日間)
tejasvee
tejasvee 2017 年 6 月 27 日
コメント済み: tejasvee 2017 年 6 月 29 日
I want to save for loop output in csv file. I want to save value of "label_index_expected" in csv file.I have tried but i am not getting how to save it.
for i = 1 : size(TV.T, 2)
[x, label_index_expected]=max(TV.T(:,i));
[x, label_index_actual]=max(TY(:,i));
if label_index_actual~=label_index_expected
MissClassificationRate_Testing=MissClassificationRate_Testing+1;
end

採用された回答

Walter Roberson
Walter Roberson 2017 年 6 月 29 日
編集済み: Walter Roberson 2017 年 6 月 29 日
numcol = size(TV.T, 2);
expecteds = zeros(numcol, 1);
for i = 1 :
[x, label_index_expected]=max(TV.T(:,i));
expecteds(i) = label_index_expected;
[x, label_index_actual]=max(TY(:,i));
if label_index_actual~=label_index_expected
MissClassificationRate_Testing=MissClassificationRate_Testing+1;
end
end
csvwrite('Youroutput.csv', expecteds);
It is possible to write each one out as you go, but it is not usually efficient to do so.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by