How can I write the content of the cells in a cell array to a text files

1 回表示 (過去 30 日間)
MA
MA 2022 年 1 月 25 日
編集済み: MA 2022 年 1 月 27 日
hello, given a herarical cell array as in the image below, how can I write the contetnt of the cells data{2,2}{i,1} to a seperate text file. i.e. instead of having them as cellarray>>table, Is there a way that can allow me to convert them to folder>>textfiles, and save them on my machine?
  6 件のコメント
Stephen23
Stephen23 2022 年 1 月 26 日
編集済み: Stephen23 2022 年 1 月 26 日
I am guessing you want something like:
[~,name] = fileparts(DATA{ii,1});
and this shoudl be in the ii, not in the jj loop:
for ii = 1:10 % "DATA" is the cell array mentioned in question
[~,name] = fileparts(DATA{ii,1});
mkdir(name)
currCell = DATA{ii,2}; % current cell in the iteration
for jj = 1:numel(currCell)
...
end
end
MA
MA 2022 年 1 月 26 日
thank you very much. problem solved.

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by