How can I make matrix name and value in one matrix

4 ビュー (過去 30 日間)
Moe
Moe 2015 年 6 月 23 日
コメント済み: Emre Bali 2021 年 5 月 8 日
I have several value with individual name for each. How can I bring all of them in one matrix that first column is value and second column is name. I have:
A = 6;
B= 7;
C = 3;
D = 5;
I want:
Z = [6,A;7,B;3,C;5,D];

回答 (1 件)

James Tursa
James Tursa 2015 年 6 月 24 日
You could use a cell array for this. E.g.,
Z = {A,'A';B,'B';C,'C';D,'D'};
  1 件のコメント
Emre Bali
Emre Bali 2021 年 5 月 8 日
How can we do this with for, ı need something like that

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by