フィルターのクリア

Removing quotations from matrix

10 ビュー (過去 30 日間)
bluexdestination
bluexdestination 2013 年 9 月 26 日
コメント済み: Jan 2013 年 9 月 29 日
Hi, I'm new to matlab and I understand that single quotations when a matrix is printed is just to show the user that it's a string in the matrix. However, I was wondering how I can remove it. Below is the code I implemented and the results I see on the command prompt. I tried other ways i.e (square brackets), but the results were the same:
prompt = 'Number of loops? ';
loopCount = input (prompt);
Imatrix = {};
for i = 1:loopCount
Imatrix{i,1} = strcat('I', num2str(i));
end
display(Imatrix)
the command window displays
Imatrix =
'I1'
'I2'
'I3'
How can I make it display the same with without the quotations?
Thanks in advance for the help.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 26 日
char(Imatrix)
  2 件のコメント
bluexdestination
bluexdestination 2013 年 9 月 28 日
thanks for the help! (:
Jan
Jan 2013 年 9 月 29 日
Although converting the cell string to a CHAR array displays the contents without quotes as a side effect, I'd prefer a method to display directly.

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

その他の回答 (1 件)

Jan
Jan 2013 年 9 月 29 日
fprintf('%s\n', IMatrix{:});

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by