Answer Output in Column Array
显示 更早的评论
i need your Help, how to do you put your output in a Column array ?
like this
ans = *
*
*
回答(1 个)
Ameer Hamza
2020-5-25
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
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!