The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: simple embedded buffer with inhereted width
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

Posts: 9
Registered: 8/29/09
simple embedded buffer with inhereted width
Posted: Dec 12, 2012 4:48 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi, all-

I want to implement a simple FIFO buffer in the simulink embedded matlab block with width determined by the input from simulink. The outputs should be both the entire contents as a matrix, and the last element. The code below works with option B (see comments), but not with option A. Option A is the desired option, but in this case, simulink reports the following error:

Data 'pres' (#162) is inferred as a variable size matrix, while its
specified type is something else.

Can anyone explain how to get this to work? Apparently, setting the problem output to be variable width will fix Option A, but the width does not change during simulation and using variable width causes endless problems down stream.

Thanks in advance,


function [pvects,pres] = FFstorage(u,Nff)

persistent xstore Nu
if isempty(xstore)
xstore = repmat(u,1,Nff);
%try an initialization


%Option A: this is the desired output

%Option B: this works, but it is not the desired output
% % pres=u;

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.