필터 지우기
필터 지우기

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일
  댓글 수: 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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by