Prevent putting a cell array inside another cell array
3 次查看(过去 30 天)
显示 更早的评论
So I am trying to make one big cell array with multiple filenames in them that uses a while loop to "append" these filenames to a cell array. I use the uigetfile() to get the file names but also allow the MultiSelect. If the user does select multiple files in one of the loops, it adds a cell array of all those filenames into one cell of an overall cell array. is there a way to make it only one big cell array?
NHxlsx = {};
AddNH = questdlg('Add Non-Host(s)?','','Yes','No','Yes');
while strcmpi(AddNH, 'Yes')
NHxlsx{end+1} = uigetfile('*.xlsx','New Non-Host File(s)','MultiSelect', 'on'); %#ok<*SAGROW>
AddNH = questdlg('Add More Non-Host?','','Yes','No','Yes');
end
So say on the first loop it askes for files and I select 4 files and on the second loop I give it 3 files, then end the loop. Instead of creating a 2x1 cell array with a 4x1 cell array in the first cell and a 3x1 cell array in the second cell, I want it to just make a 7x1 cell array.
Also note: I might have to add the path for the files selected with [file, path] = uigetfile(... so I'm not sure how this will affect it
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!