Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Saving mutiple files as structs

1 Ansicht (letzte 30 Tage)
Bobby Haynes
Bobby Haynes am 5 Apr. 2019
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hi, I am using the 'uipickfiles' function to select multiple .txt files and want to get data from those multiple files but its saved as a cell. Is there a way I can save them as an array? I want the same structs that come with 'dir', however, 'cell2struct' is not giving me those values. Is there psuedocode someone can show me? Thanks!

Antworten (1)

A. Sawas
A. Sawas am 6 Apr. 2019
Asuming you get the files in cell array called "files", you can run the following loop to build the struct array "s_files" you want:
s_files = dir(files{1});
for i=2:length(files)
s_files = [s_files; dir(files{i})];
end

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by