フィルターのクリア

How to DEconcatenate a string in matlab?

7 ビュー (過去 30 日間)
John Rebbner
John Rebbner 2019 年 1 月 13 日
コメント済み: Stephen23 2019 年 1 月 18 日
Hello!
How to deconcatenate a string in matlab? I read some data (Names) from excel, and sort them in a matrix. Then the I use the stored data and concatenate them with an existing string, after that I write the new string in excel, but the data (Names) are concatenated and my code put everithing in one cell.
How to say to Matlab not to concatenate my string???
  2 件のコメント
madhan ravi
madhan ravi 2019 年 1 月 13 日
can you upload your code ? and an example of filenames?
Walter Roberson
Walter Roberson 2019 年 1 月 13 日
Use cell arrays of character vectors when you xlswrite() instead of char arrays.

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

採用された回答

John Rebbner
John Rebbner 2019 年 1 月 13 日
for i=end_ln:length(raw(:,1));
.
.
.
if raw{i,1} == 1 && isnan(raw{i,1})~=1 && isempty(raw{i,1})~=1;
[NameX(i,1)] =(raw(i,3)); % where raw(i,3) is the column C from the xls file, conteins the names
end
end
c = [NameX{:}] % and here it puts all the names as a concatenated text
  5 件のコメント
Walter Roberson
Walter Roberson 2019 年 1 月 18 日
no fprintf cannot write cell arrays. you would use cell expansion . For example
fprintf(fid, '%s\n', Cell_array_of_labels{:});
Stephen23
Stephen23 2019 年 1 月 18 日
"Does fprint fun can write a cell array in a file????"
No, but you can use a comma-separated list to provide multiple input arguments:

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by