简体   繁体   中英

The method of construct a matrix in MATLAB

I used the function "wavread()" to load a .wav file into memory,and store the signals in column vector y,then I get a row vector yRow(=y').

Then I define a matrix myframe=zeros(frameNum,frameLen);

what I want to do is fill myframe by the items of yRow:

index=1;
myframe(1,:)=yRow(index:index+frameLen-1)

for i=2:frameNum-1
   myframe(i,:)=yRow(index*frameStep:index*frameStep+frameLen-1)
   index=index+1
end

myframe(frameNum,1:sigLen-frameNum*frameStep+1)=yRow(frameNum*frameStep:sigLen)

But it takes a very long time to fill "myframe",I think there must be something wrong,please help me to find out the issue. Thanks.

在matlab中使用重塑函数为:

myframe=reshape(y,frameNum,frameLen);

Adding semicolon at the end of each sentence can stop outputing informations in command window.The program can run in back end quickly. SO,this is the matter of ";".

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