Answer Output in Column Array
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i need your Help, how to do you put your output in a Column array ?
like this
ans = *
*
*
0 comentarios
Respuestas (1)
Ameer Hamza
el 25 de Mayo de 2020
It depends on how the answer is generated. Suppose the following cases.
>> x = {1, 2, 3, 4};
>> x{:}
ans =
1
ans =
2
ans =
3
ans =
4
You can get an answer as a column matrix with the following code
>> x = {1, 2, 3, 4};
>> [x{:}].'
ans =
1
2
3
4
If it is generated using a struct then
>> s(1).a = 1;
s(2).a = 2;
s(3).a = 3;
s(4).a = 4;
>> s.a
ans =
1
ans =
2
ans =
3
ans =
4
Then use this to create column matrix
>> s(1).a = 1;
s(2).a = 2;
s(3).a = 3;
s(4).a = 4;
>> [s.a].'
ans =
1
2
3
4
0 comentarios
Ver también
Categorías
Más información sobre Multidimensional Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!