Array to table not working after forming matrix

1 次查看(过去 30 天)
altitude = [ 5 10 15 20 25 30 35 40 45 50 55 60 65 ];
flux_up = [ 35 55 80 110 125 130 140 150 155 175 225 275 325];
flux_down = [ 50 75 100 125 150 155 170 175 180 225 275 325 380 ];
matrix = [transpose(altitude); transpose(flux_up); transpose(flux_down) ]
table = array2table(matrix)
But I am getting a 39x1 table and it should be a table with 3 columns and 13 rows

回答(2 个)

Walter Roberson
Walter Roberson 2017-7-30
You have
matrix = [transpose(altitude); transpose(flux_up); transpose(flux_down) ]
You need
matrix = [transpose(altitude), transpose(flux_up), transpose(flux_down) ]

John BG
John BG 2017-7-30
Hi Mr Kennedy
Do you mean this?
altitude = [ 5 10 15 20 25 30 35 40 45 50 55 60 65 ]';
flux_up = [ 35 55 80 110 125 130 140 150 155 175 225 275 325]';
flux_down = [ 50 75 100 125 150 155 170 175 180 225 275 325 380 ]';
T=table(altitude,flux_up,flux_down)
T =
13×3 table
altitude flux_up flux_down
________ _______ _________
5 35 50
10 55 75
15 80 100
20 110 125
25 125 150
30 130 155
35 140 170
40 150 175
45 155 180
50 175 225
55 225 275
60 275 325
65 325 380
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by