How to write a structure field to Excel?

3 views (last 30 days)
Hi all
I have a structure that one of its fields has n members, and I want to write them to an Excel in one column in rows. trying to convert this field to array,
doing :
vals = [s(1:end).name]
instead of giving me :
vals= ['a', 'b', 'c', ..]
gave:
vals= ['abcde,...']
how do I correct it ?

Accepted Answer

Adam Danz
Adam Danz on 1 May 2020
vals = {s(1:end).name};
  5 Comments
Adam Danz
Adam Danz on 1 May 2020
Edited: Adam Danz on 1 May 2020
content = dir(. . . . . .);
content([content.isdir]) = []; % remove directories
filenames = cell(size(content));
% Extract the filename without the extentions
for i = 1:numel(files)
[~, filenames{i}] = fileparts(content(i).name);
end
farzad
farzad on 2 May 2020
Thank you very much ! resolved

Sign in to comment.

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!