필터 지우기
필터 지우기

Append numbers to matrix

조회 수: 2 (최근 30일)
Fiboehh
Fiboehh 2011년 3월 6일
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
Jos (10584)
Jos (10584) 2011년 3월 7일
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".

댓글을 달려면 로그인하십시오.

답변 (2개)

John D'Errico
John D'Errico 2011년 3월 6일
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.

Jos (10584)
Jos (10584) 2011년 3월 7일
Why bother? Simply read in the values, append to the previous matrix and do a simple RESHAPE when needed.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by