How to replace number with string in a matrix

조회 수: 7 (최근 30일)
Ali Raza
Ali Raza 2022년 8월 24일
댓글: Lavanya 2022년 9월 14일
I want to print like:
A =
1 1 1 1 1
1 1 1 1 1
1 1 Ali 1 1
1 1 1 1 1
1 1 1 1 1
but there are errors in my code:
for i = 1:5
for j = 1:5
A(i,j) = 1;
end
end
A

채택된 답변

Geoff Hayes
Geoff Hayes 2022년 8월 24일
이동: Cris LaPierre 2022년 8월 24일
@Ali Raza - if you wish to combine numeric values with strings, then I think that you would need to use a cell array.
  댓글 수: 5
Geoff Hayes
Geoff Hayes 2022년 9월 13일
@Lavanya - I suggest that you remove this comment and create a new question as it doesn't seem to relate to the question posed by @Ali Raza. Also, has all of this code been put into your app, or just the relevant pieces? I would expect that your app (build from App Designer) would have the axes that you need to draw to...and so you wouldn't need the code to create a figure, add the subplots, etc....unless you want them to appear outside of the app.
Lavanya
Lavanya 2022년 9월 14일
Here is the ''app1.mlapp'' file. This '.mlapp' file should work same as above the code. But its not working. Can you help me with this?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by