How to replace number with string in a matrix

3 ビュー (過去 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 日
Moved: 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 件のコメント
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 件)

カテゴリ

Find more on Characters and Strings 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!

Translated by