How to print all 1x243 elements of an array in a single row
11 次查看(过去 30 天)
显示 更早的评论
Greetings
I could really use some guidance
I have a 1x243 array and I would like the values to print all on the same row but multiple columns (e.g. row 1, column A...column Z have output).
Right now the array prints out on the .csv like this:
14-02-TL-C-A-1 1/4/17 67.124263
7.29E+01 7.05E+01 84.4815
6.92E+01 8.75E+01 76.180197
8.69E+01 7.62E+01 87.71914
9.30E+01 8.81E+01 106.408918
1.02E+02 1.09E+02 108.35056
1.08E+02 1.19E+02 124.219392
1.34E+02 1.29E+02 130.762177
I would really like to print it out like this:
A B C D E F G
row 1: 14-02-TL 1/4/17 67.124 7.29 7.05 84.48 6.92
Thank you
回答(1 个)
Navdha Agarwal
2019-6-21
You can use reshape.
If you have an array of dimensions 1x243, then using the following you can convert it to an array of dimensions 243x1. This will display all the elements of the array in the single row having multiple columns.
B = reshape(A,[243,1]) % generates an array B of dimension 243x1
For more information, you can refer to the documentation of the function reshape
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!