Loading multiple structure from a folder
2 次查看(过去 30 天)
显示 更早的评论
I am tried load multiple structures from a folder but I got a error
below:
filepath = '..\sol_active_case11\';
mydata = dir(fullfile(filepath,'*.mat'));
full_file_names = fullfile(filepath,{mydata.name});
%% natsortfiles: Sorts text by character code and by number value
% By default matches integer substrings and performs a case-insensitive ascending sort.
% Options to select the number format, sort order, case sensitivity, etc.
mydata = natsortfiles(mydata);
%
for n = 1:numel(mydata)
F = fullfile(mydata(n).folder,mydata(n).name);
mydata(n).data = load(F);
end
A = [mydata.data];
Error using horzcat Number of fields in structure arrays being concatenated do not match.
Concatenation of structure arrays requires that these arrays have the same set of fields.
Error in Active_flow1D_case11_plot (line 23)
A = [mydata.data];
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!