Check for the length of the matrix

조회 수: 1 (최근 30일)
Lev Mihailov
Lev Mihailov 2019년 7월 12일
댓글: Lev Mihailov 2019년 7월 12일
Hello! I'm trying to read a file that will give me a matrix, the dimension is 1000x200, but the problem is that it gives me 998, can I add this length, for example, with zeros?
atmatrix=1x200 uint16; atmatrix all meaning 1000
i=200;
matrix=fread(fileID,[datmatrix(i),1],'uint8');
if length(matrix)<1000;
xmatrix=length(1000);
end

답변 (1개)

KSSV
KSSV 2019년 7월 12일
편집: KSSV 2019년 7월 12일
A = rand(3) ;
B = zeros(5) ;
[nx,ny] =size(A);
B(1:nx,1:ny) = A ;
Also read about padarrays
  댓글 수: 1
Lev Mihailov
Lev Mihailov 2019년 7월 12일
I did not quite understand what you meant
atmatrix=1x200 uint16; atmatrix all meaning 1000
i=200;
matrix=fread(fileID,[datmatrix(i),1],'uint8');
A=zeros(2);
if length(matrix)<1000;
xmatrix=[matrix A];
end
and this does not work

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by