简体   繁体   中英

Matlab error while creating a matrix

I want to insert 'double' type values in a matrix. For that I am creating a matrix with following lines of Matlab code:

dpitchcnt=(N/256); %N is total number of byte
pitchvec(1:int64(dpitchcnt)); %creating a matrix 'pitchvec' with 1 row and int64(dpitchcnt)' columns   
size(pitchvec) %Trying to display the size.

I am getting the following error while carrying out the above operation:

Undefined function or method '_colonobj' for input arguments of type 'int64'. Error in ==> sample at 31 pitchevec(1:int64(dpitchcnt));

What am I doing wrong?

The syntax varName(1:10) will get the first 10 values of varName , not create the variable varName ;

To create a matrix you can use

pitchvec = zeros(1,int64(dpitchcnt)); %A zero-matrix
matrixSize = size(pitchvec);

You can also use ones(n,m);%Create an times m matrix with 1 all over.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM