matrix columns in matlab

8 Ansichten (letzte 30 Tage)
Amy Topaz
Amy Topaz am 12 Mär. 2022
Beantwortet: Voss am 29 Mai 2022
A = 1*1000 matrix
I need another matrix Y which has all the columns as A
Y = 1000*1000 matrix
How to do that??
  2 Kommentare
Scott MacKenzie
Scott MacKenzie am 12 Mär. 2022
Use the repmat function to create Y from repeated versions of A
Torsten
Torsten am 12 Mär. 2022
If A is 1x1000 and Y is 1000x1000, Y cannot have all its columns as A since the columns of A have 1 element, the columns of Y have 1000 elements. Y can only have the same rows as A.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Voss
Voss am 29 Mai 2022
A = 1:1000
A = 1×1000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Y = repmat(A.',1,1000)
Y = 1000×1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by