MATLAB Answers

0

Check for the length of the matrix

Asked by Lev Mihailov on 12 Jul 2019
Latest activity Commented on by Lev Mihailov on 12 Jul 2019
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

  0 Comments

Sign in to comment.

Tags

Products

1 Answer

KSSV
Answer by KSSV
on 12 Jul 2019
Edited by KSSV
on 12 Jul 2019

A = rand(3) ;
B = zeros(5) ;
[nx,ny] =size(A);
B(1:nx,1:ny) = A ;
Also read about padarrays

  1 Comment

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

Sign in to comment.