Borrar filtros
Borrar filtros

How to print all 1x243 elements of an array in a single row

2 visualizaciones (últimos 30 días)
Rae Pond
Rae Pond el 6 de Jun. de 2018
Respondida: Navdha Agarwal el 21 de Jun. de 2019
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

Respuestas (1)

Navdha Agarwal
Navdha Agarwal el 21 de Jun. de 2019
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

Categorías

Más información sobre Creating and Concatenating Matrices 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!

Translated by