Prevent putting a cell array inside another cell array
8 views (last 30 days)
Show older comments
Jacob Kelley
on 21 Oct 2019
Answered: Jacob Kelley
on 21 Oct 2019
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!