フィルターのクリア

convert string to cell array

1 回表示 (過去 30 日間)
chlor thanks
chlor thanks 2016 年 7 月 1 日
コメント済み: Walter Roberson 2016 年 7 月 5 日
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?

採用された回答

Thorsten
Thorsten 2016 年 7 月 1 日
clear x
x{1} = 'A';
x{end+2} = 'B';
x{end+3} = 'C';
and so on
  4 件のコメント
chlor thanks
chlor thanks 2016 年 7 月 5 日
編集済み: chlor thanks 2016 年 7 月 5 日
This is what I have been working on, I am trying to make the last line AllExcel into a cell array but it did not come out right... I have a result of AllExcel that is constantly updating and I am not really sure how to fix it. Will you able to help me on this? Much appreciated!
for k = 1 : numFolders
SubFolder = listOfFolderNames{k};
filePattern = fullfile(SubFolder, '*.xls*');
ExcelFiles = dir(filePattern);
if ~isempty(ExcelFiles)
for k2 = 1 : length(ExcelFiles)
AllExcel={ExcelFiles(k2).name}
end
end
end
Walter Roberson
Walter Roberson 2016 年 7 月 5 日
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);
end
end
end
However, what I would do instead is look in the File Exchange for https://www.mathworks.com/matlabcentral/fileexchange/19550-recursive-directory-listing or https://www.mathworks.com/matlabcentral/fileexchange/32226-recursive-directory-listing-enhanced-rdir

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by