Answer Output in Column Array
Show older comments
i need your Help, how to do you put your output in a Column array ?
like this
ans = *
*
*
Answers (1)
Ameer Hamza
on 25 May 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
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!