Effacer les filtres
Effacer les filtres

How to store vector name and value in the result

7 vues (au cours des 30 derniers jours)
joms
joms le 22 Juil 2018
Commenté : Aquatris le 22 Juil 2018
I have the following vectors and want to make it as table or array
Parameter1=1
Parameter2=2
Parameter3=3
the result will be
disp('| Parameter | Value ')
A=[Parameter1 1;Parameter2 2;Parameter3 3]

Réponses (1)

Aquatris
Aquatris le 22 Juil 2018
Here is an example code;
xName = ['x1';'x2';'x3';'x4'];
xVal = [1;2;3;4];
A = table(xName,xVal);
Result look like this;
A =
xName xVal
_____ ____
x1 1
x2 2
x3 3
x4 4
  4 commentaires
joms
joms le 22 Juil 2018
it works but still gives me "'x1'" output i want "x1" only
Aquatris
Aquatris le 22 Juil 2018
Try the second method.
xName(1,1:2) = 'x1';
xName(2,1:3) = 'x12';
xName(3,1:5) = 'x1234';
xName(4,1:7) = 'x123456';

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics 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