Effacer les filtres
Effacer les filtres

How can I make matrix name and value in one matrix

2 vues (au cours des 30 derniers jours)
Moe
Moe le 23 Juin 2015
Commenté : Emre Bali le 8 Mai 2021
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];

Réponses (1)

James Tursa
James Tursa le 24 Juin 2015
You could use a cell array for this. E.g.,
Z = {A,'A';B,'B';C,'C';D,'D'};
  1 commentaire
Emre Bali
Emre Bali le 8 Mai 2021
How can we do this with for, ı need something like that

Connectez-vous pour commenter.

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by