Forming a matrix from data

1 ビュー (過去 30 日間)
Andy Wileman
Andy Wileman 2021 年 3 月 3 日
コメント済み: Andy Wileman 2021 年 3 月 3 日
Hi,
I think I'm going mad, does anyone know why Matlab will not form a Matrix from the following. I've separated each of the 10 elements with a ; as it says in the help.
Kind regards,
Andy
a=[0.443412162162090
0.443412162162090
0.443412162162090
0.696790540540449
0.570101351351255
0.570101351351255
0.696790540540449
0.823479729729644
0.823479729729644
0.823479729729644;
0.443412162162090
4.11739864864855
10.7052364864864
12.7322635135134
13.4923986486486
14.2525337837837
14.6326013513513
14.6326013513513
15.2660472972972
15.2660472972972;
0.443412162162090
5.51097972972963
23.6275337837837
43.5177364864864
56.1866554054053
62.2677364864864
64.9282094594594
66.9552364864864
68.2221283783783
68.7288851351351;
0.443412162162090
5.63766891891882
27.8082770270270
57.5802364864865
88.1123310810811
110.536317567568
126.372466216216
135.240709459459
140.941722972973
143.855574324324;
0.570101351351225
5.89104729729721
30.3420608108107
45.2913851351350
60.2407094594594
74.9366554054054
105.215371621622
120.291385135135
135.240709459459
149.683277027027;
0.570101351351285
5.89104729729721
33.8893581081080
45.2913851351351
60.2407094594594
75.1900337837838
105.088682432432
120.164695945946
135.367398648649
149.683277027027;
0.570101351351405
6.27111486486491
35.6630067567568
45.2913851351351
60.2407094594594
75.3167229729729
105.342060810811
120.291385135135
135.240709459459
149.809966216216;
0.570101351351465
6.52449324324336
37.4366554054054
45.4180743243243
60.2407094594594
75.3167229729729
105.215371621622
120.291385135135
135.367398648648
149.809966216216;
0.570101351351495
7.03125000000014
39.0836148648649
45.4180743243244
60.2407094594595
75.1900337837838
105.088682432432
120.291385135135
135.367398648648
149.936655405405]

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 3 月 3 日
To put elements on separate rows, you can either put a semicolon between the numbers, or enter them on separate lines. You have done both, so every number is being placed on a separate row. Place elements on the same line that you want in the same row, separated with a comma. Otherwise, use '...' to indicate the row continues on the next line.
a=[0.443412162162090, 0.443412162162090, 0.443412162162090, 0.696790540540449, 0.570101351351255, 0.570101351351255, 0.696790540540449, 0.823479729729644, 0.823479729729644, 0.823479729729644 % doesn't need a semicolon
0.443412162162090, 4.11739864864855, 10.7052364864864, 12.7322635135134, 13.4923986486486, 14.2525337837837, 14.6326013513513, 14.6326013513513, 15.2660472972972, 15.2660472972972; % but you can still use if you want
0.443412162162090, ...
5.51097972972963, ...
23.6275337837837, ...
43.5177364864864, ...
56.1866554054053, ...
62.2677364864864, ...
64.9282094594594, ...
66.9552364864864, ...
68.2221283783783, ...
68.7288851351351; % semicolon used to indicate the end of a row
0.443412162162090, ...
5.63766891891882, ...
27.8082770270270, ...
57.5802364864865, ...
88.1123310810811, ...
110.536317567568, ...
126.372466216216, ...
135.240709459459, ...
140.941722972973, ...
143.855574324324;
0.570101351351225, ...
5.89104729729721, ...
30.3420608108107, ...
45.2913851351350, ...
60.2407094594594, ...
74.9366554054054, ...
105.215371621622, ...
120.291385135135, ...
135.240709459459, ...
149.683277027027;
0.570101351351285, ...
5.89104729729721, ...
33.8893581081080, ...
45.2913851351351, ...
60.2407094594594, ...
75.1900337837838, ...
105.088682432432, ...
120.164695945946, ...
135.367398648649, ...
149.683277027027;
0.570101351351405, ...
6.27111486486491, ...
35.6630067567568, ...
45.2913851351351, ...
60.2407094594594, ...
75.3167229729729, ...
105.342060810811, ...
120.291385135135, ...
135.240709459459, ...
149.809966216216;
0.570101351351465, ...
6.52449324324336, ...
37.4366554054054, ...
45.4180743243243, ...
60.2407094594594, ...
75.3167229729729, ...
105.215371621622, ...
120.291385135135, ...
135.367398648648, ...
149.809966216216;
0.570101351351495, ...
7.03125000000014, ...
39.0836148648649, ...
45.4180743243244, ...
60.2407094594595, ...
75.1900337837838, ...
105.088682432432, ...
120.291385135135, ...
135.367398648648, ...
149.936655405405]
a = 9×10
0.4434 0.4434 0.4434 0.6968 0.5701 0.5701 0.6968 0.8235 0.8235 0.8235 0.4434 4.1174 10.7052 12.7323 13.4924 14.2525 14.6326 14.6326 15.2660 15.2660 0.4434 5.5110 23.6275 43.5177 56.1867 62.2677 64.9282 66.9552 68.2221 68.7289 0.4434 5.6377 27.8083 57.5802 88.1123 110.5363 126.3725 135.2407 140.9417 143.8556 0.5701 5.8910 30.3421 45.2914 60.2407 74.9367 105.2154 120.2914 135.2407 149.6833 0.5701 5.8910 33.8894 45.2914 60.2407 75.1900 105.0887 120.1647 135.3674 149.6833 0.5701 6.2711 35.6630 45.2914 60.2407 75.3167 105.3421 120.2914 135.2407 149.8100 0.5701 6.5245 37.4367 45.4181 60.2407 75.3167 105.2154 120.2914 135.3674 149.8100 0.5701 7.0313 39.0836 45.4181 60.2407 75.1900 105.0887 120.2914 135.3674 149.9367
  1 件のコメント
Andy Wileman
Andy Wileman 2021 年 3 月 3 日
Thank you Cris, it makes sense now. I think because I brought it in from a data set I got confused. Once again, thanks.

サインインしてコメントする。

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by