Removing quotations from matrix

11 views (last 30 days)
bluexdestination
bluexdestination on 26 Sep 2013
Commented: Jan on 29 Sep 2013
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.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 26 Sep 2013
char(Imatrix)
  2 Comments
bluexdestination
bluexdestination on 28 Sep 2013
thanks for the help! (:
Jan
Jan on 29 Sep 2013
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.

Sign in to comment.

More Answers (1)

Jan
Jan on 29 Sep 2013
fprintf('%s\n', IMatrix{:});

Categories

Find more on Matrices and Arrays 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!