How to write a structure field to Excel?

2 vues (au cours des 30 derniers jours)
farzad
farzad le 1 Mai 2020
Commenté : farzad le 2 Mai 2020
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 ?

Réponse acceptée

Adam Danz
Adam Danz le 1 Mai 2020
vals = {s(1:end).name};
  5 commentaires
Adam Danz
Adam Danz le 1 Mai 2020
Modifié(e) : Adam Danz le 1 Mai 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 le 2 Mai 2020
Thank you very much ! resolved

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by