我有来自输入的AD转换信号,该信号存储在固定大小的缓冲区中 . 在我读取过程的每次迭代中,数据都被发送到一个函数(让我们称之为function.m) .

我的主文件(main.m,比方说)读取一些样本并存储在变量中 . 然后它调用function.m,我在那里进行一些处理 . 在function.m中,我想让它调用我正在设计的simulink块,并将function.m的返回值作为在这个simulink块中进行处理的结果 .

要获得更直观的方法:

  • main.m
ARec = dsp.AudioRecorder('SampleRate',Fs, ...
'NumChannels',CH_AD, ...
'BufferSizeSource','Property',...
'BufferSize',Buffer, ...
'QueueDuration',QueueDuration, ... // tamanho pode ser variavel
'SamplesPerFrame', Buffer);

while(1),
 yh1 = step(ARec);
 [yh3] = function_PhaseShifter(yh1);
 step(APly, yh3);
end;
  • function_PhaseShifter
function [y]=function_PhaseShifter(x)
    %Here do some simulink work
    %where X is the input to simulink block
    %y is assigned from simulink block's result
end