Append numbers to matrix
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hellow, i have a 16 collums x 256 rows matrix. I'm serial reading out each time 1 value from a microcontroller and have to append this value to the collum. After 16 values, it has to spring to a new collum. And so on till the matrix is full. Anyone who knows how to make this in matlab?
Thx in advance
1 Kommentar
Jos (10584)
am 7 Mär. 2011
Do you really mean 16 columns by 256 row, and a shift to a new column after 16 values. This will leave rows 17 to 256 "blank".
Antworten (2)
John D'Errico
am 6 Mär. 2011
Since you already know how many elements you will end up with, just preallocate a matrix of the proper size, zeros(16,256). Then stuff each element in using a single index, that will vary from 1 to (16*256). Matlab will do as you desire.
0 Kommentare
Jos (10584)
am 7 Mär. 2011
Why bother? Simply read in the values, append to the previous matrix and do a simple RESHAPE when needed.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!