Simulink memory error in "frame processing mode" - simulink

Error:
Cannot propagate frame-based signal through input 'MATLAB Function5' because this input
expects a sample-based signal. The frame-based signal originates from 'mzmzmzcpy/MATLAB
Function5/ SFunction '. Consider inserting an Unbuffer in the signal path.
I am using frame based processing, I save a whole frame in memory and want to read this frame
at the time I need it at the input of same block but every time I get this error, I have tried
both "memory" and "data store memory" blocks, can anybody help me to know how can I change
sampling mode of input as I have tried using "converter" block to change output of "data read
memory" block to frame output even then i found the same error(Cannot propagate frame-based
signal through input 'MATLAB Function5' because this input expects a sample-based signal), then
i tried using buffer but then i found the error given at the beginning of this note.

Have you defined the output(s) of your MATLAB Function block "MATLAB Function5" to be frame-based rather than sample-based? See MATLAB Function Block Editor in the documentation for more details.
EDIT:
If I understand correctly, from your picture, it looks like the problem is with the signal coming out of the memory block. I think memory blocks do not support frame-based signals (or at least, from what I can see in the documentation). As suggested in the comments, try inserting a Signal Specification block before feeding the signal to the MATLAB Function block to enforce a frame-based signal. Failing that, I am not sure, you may want to contact MathWorks for help.

Related

Can state space matrix initial conditions be set by signals in simulink

I want to feed the initial conditions in state space matrix block in simulink by using signals "from-go to signal blocks". I m trying it with signal blocks but some errors pop up at the end and it says that the signal variables used as initial conditions are all undefined variable. In other words there exists "Undefined function or variable".
Any help appreciated, thank you
I take it you are using the State-Space block. The "initial conditions" parameter for the block is just that, a parameter:
You need to understand the difference between a parameter and a signal: a parameter is something that is constant throughout the simulation (e.g. a variable in the MATLAB workspace), whereas a signal is something whose value is updated at each time step. You cannot use a "signal" to parameterise a block, it's not possible, you can only use a parameter. Hope that clears things up.
If I misunderstood your question, please provide more details, including which block(s) you are using and if possible a screenshot of the model and the relevant block parameters.

Simulink: individual signal output from bus input (based on signal name)

I have a complex Simulink model and want to generate in a subsystem one simple error message signal out of a lot of incoming error observing signals.
These incoming signals are organised in a bus and are always 0, exept when an error occurs: then there is an edge to value.
The error message should contain an individual bit code which is defined for every error name and error value in an excel list.
How can I assign this error code to a specific error signal with rising edge? I need something like a lookup function:
for (every signal):
if signal has edge to value,
look in list to signal name
and output its error code.
My idea was to use a MATLAB function block with a bus input and a one-dimensional output. A .mat file generated before Simulation start contains a struct with the list inputs from the excel file and should be used as a parameter in the MATLAB function.
This solution seems a bit difficult though, since dynamic field referencing and interating through a structure is not supported for code generation. I cannot even get the signal name from the struct because the fieldnames function is not supported, too.
I am now wondering if there is another approach or the MATLAB function is still doable for my problem. Can I generate the code for the MATLAB function block in a PreLoadfcn? Does a S-function make sense here? Or is there even a Simulink based solution which does the Signal conversion?

import a continuous bitsream from workspace into simulink using "In" block and then buffer it using "buffer" block

how to import a bitsream form binary vector from workspace into simulink.Actually I have found that I can use simin block or In block but my binary vector is independant of time. I tried to use Const block and it works but afer that when I wanted to put my output in the Buffer block in simulink, it didn't work because the input is continuous and not discrete. So I am asking if it's a way to add time to my binary uni-dimensional without having any influence on the result?and how can I do it?
Or is there another way to import this date to avoid this problem with Buffer block?
Your screenshot shows your constant block to have a sample time of Inf. As the error message suggest, you need to change that to a discrete sample time. In addition, you should also:
check your model is using a fixed-step solver
check what time step you are using for your chosen fixed-step solver (ideally the same as your constant).
You can have multi-rate models, but you need to manage the rate transitions with Rate Transition blocks. For more details on sample times, see the documentation, in particular how to view sample time information in a Simulink model. You should probably also have a quick look at the Choose a Solver section.

How can I change a Block parameter in Simulink with Serial Port?

I am loading my Simulink Model to a microprocessor. After that I want to change a value of a Block parameter.
In the picture below the data comes to Matlab Function block is coming from Serial Port. Now, appearently th incoming data is assigned to input u of Matlab Function block. In that Matlab Function block I want to write a code that changes , for example, coefficient of s in the Transfer Fcn block. Or it can change any other parameter you can give in code hypothetically.
If anybody can give me any solution that would be ver much appreaciated!. Thank you in advance.
Substitute a custom-made subsystem for the transfer function whose parameters have to change, and create the subsystem from basic blocks so that coefficients can be read from signal sources. You might be interested in this
http://blogs.mathworks.com/seth/2011/03/08/how-do-i-change-a-block-parameter-based-on-the-output-of-another-block/
Even if you don't want to change parameters at every time step, the restriction
"[...] calls to set_param also preclude the model from ever being compiled
into a real-time application."
seems relevant to your case.
Anyway, as far as I know the post linked above still applies in 2014.
Hope that helps.

See if a signal originates from a bus in Simulink

We have an S-Function that does not support bus signals in Simulink, so programmatically I am trying to find a way to determine if the signal type of an inport/outport originates from/is going to a bus so I can demux and mux the signal automatically as needed. Unfortunately, the only block property I can find that reliably tells if the port comes from or goes to a bus is if it inherits properties from the bus, which might not be true in all cases. Any idea on how to figure this out?
Well, I got an answer back from Matlab support, I have tried this and tested this and it works, the only thing is that Mathworks recommends using a Bus Selector instead of a DEMUX block. In a nutshell, here is what you do:
Find the handles of all signal lines in the model.
Get the names if you need to, however, I did this using handles and it worked fine.
Compile the model to create the 'CompiledBusType' property.
Obtain the 'CompiledBusType' property of each signal line in the model. Then terminate the compilation mode of the model.
'CompiledBusType' returns 'NOT_BUS', 'VIRTUAL_BUS', and 'NON_VIRTUAL_BUS'.
Hope this question helps someone else out, had to wait a week for Matlab to get back to me.