convert string to cell array

6 views (last 30 days)
I have a for loop that gives results that are constantly updating
x= 'A'
x= 'B'
x= 'C'
But I would like to convert that into x= {'A', 'B', 'C'}
Any Suggestions?

Accepted Answer

Thorsten on 1 Jul 2016
clear x
x{1} = 'A';
x{end+2} = 'B';
x{end+3} = 'C';
and so on
Walter Roberson
Walter Roberson on 5 Jul 2016
numfiles = 0;
for k = 1 : numFolders
SubFolder = listOfFolderNames{k};
filePattern = fullfile(SubFolder, '*.xls*');
ExcelFiles = dir(filePattern);
if ~isempty(ExcelFiles)
for k2 = 1 : length(ExcelFiles)
numfiles = numfiles + 1;
AllExcel{numfiles} = fullfile(SubFolder, ExcelFiles(k2).name);
However, what I would do instead is look in the File Exchange for or

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by