export structure values to csv or txt file

4 ビュー (過去 30 日間)
ushamary sharma
ushamary sharma 2019 年 12 月 3 日
コメント済み: ushamary sharma 2019 年 12 月 6 日
stats = graycoprops(Imggray)
Hi ,I am using this built-in function which gives me four values in structure format. Now i want to run this code in loop and store these 4 values for each data set in a CSV or txt file. The values are not getting appended rather gets overwrite.

回答 (1 件)

Divya Gaddipati
Divya Gaddipati 2019 年 12 月 6 日
You can use dlmwrite with the “append” property.
Here’s a rough sketch of the code for your reference
for =
...
stats = graycoprops(Imggray)
if(~isfile('test.csv'))
dlmwrite('test.csv', struct2array(stats), 'delimiter', ',');
else
dlmwrite('test.csv', struct2array(stats), 'delimiter', ',', '-append');
end
...
end
For more information on dlmwrite, you can refer to the following link:
Hope this helps!
  1 件のコメント
ushamary sharma
ushamary sharma 2019 年 12 月 6 日
thankyou so much

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by