質問をご覧いただきありがとうございます。
同じcell内(1×1のcell行列)で変数Aと文字が共存させたいと考えています。
しかし、変数Aと文字を同じcell内に入れた場合

 Akzeptierte Antwort

Hernia Baby
Hernia Baby am 23 Nov. 2022

1 Stimme

数字と文字を共存させる場合、最終的には文字型に変えるしか方法はありません。
理由はどんな変数であれデータ型というのがあるからです。
string型かchar型にする必要があると思われます
一例です。
a = 2;
b = "変数" + a
b = "変数2"
他にはこんな感じも…
a = (1:10)';
b = "変数" + a
b = 10×1 string array
"変数1" "変数2" "変数3" "変数4" "変数5" "変数6" "変数7" "変数8" "変数9" "変数10"

1 Kommentar

Huge Grave
Huge Grave am 23 Nov. 2022
ご回答ありがとうございます。
具体的な例も乗せていただきとても分かりやすかったです。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu データ型の変換 finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021a

Tags

Community Treasure Hunt

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

Start Hunting!