MATLAB Answers

error input uint8 simulink

48 views (last 30 days)
Sela on 3 Oct 2017
Commented: Prateek Tiwari on 1 Jun 2020
Hi everybody,
I want to design a simple digital systen with Simulink in order to:
1. simulate its behaviour with Matlab
2. generate the VHDL code for a FPGA synthesis.
I would use the same system design to simulation and generation but to simulate with Matlab I must stimulate my circuit with input block (in1) using a "double" data type, instead to generate VHDL code I must use in1 with data type "uint8".
a = [0 1 1 1 0 0 0 1 0 1];
in1 = uint8(a);
If I try to simulate on Matlab that code with I have this error :
"Input format not supported. Available formats include: (1) a Simulink.SimulationData.Dataset object, (2) a double non-complex matrix, (3) a structure with or without time, (4) a MATLAB timeseries object, (5) a structure with MATLAB timeseries objects at all leaves (for bus input). All formats require the data to be finite (not Inf or NaN)."
Is it not possible use the same configuration to simuate and generate HDL code?
Could you help me please?

Accepted Answer

Sela on 5 Oct 2017
Edited: Sela on 5 Oct 2017
Hi, the solution is to define a structure of time :
a = [0 1 0 1 0 1 0 1]; in1 = uint8(a); s.time = 0 ; s.signals.values = in1;
and change the input in the configuration to "s" instead of "in1".
Thanks to everyone

More Answers (3)

Walter Roberson
Walter Roberson on 3 Oct 2017
I am not sure which block you are using in Simulink, but From Workspace requires that that time information be available somehow . The time can be explicit like a timeseries object, or a structure in the proper format with the proper fields. For arrays, the time is taken from the first column of the data -- but in such cases the array must be double because times must be double.
From Workspace blocks are not able to import "just plain data". From Workspace blocks are intended to deliver data at a particular time: they are blocks for execution of a model, where as importing plain data is something that would be used in a procedural language.
Walter Roberson
Walter Roberson on 3 Oct 2017
I am not very familiar with the process. Generally you would mark data into the HDL or data out of the HDL as a signal. You would generally generate some input condition outside the HDL to trigger action, and several cycles later you would get an output from the HDL. There is an example at

Sign in to comment.

Bharath Venkataraman
Bharath Venkataraman on 4 Oct 2017
You can try using the Signal From Workspace block instead. I think this may work better with your data.

Kiran Kintali
Kiran Kintali on 5 Oct 2017
can you please share your matlab code or simulink model?
  1 Comment
Prateek Tiwari
Prateek Tiwari on 1 Jun 2020
Hi erveryone, I need to post this question here, because no one responds to the question i have asked in the past. Sorry for that, but would appreciate if you can answer.
Hello everyone, I am having an issue with the interaction of matlab function block in the simulink with my model block. Below you can also find the picture.
I have created a matlab function with three inputs and 1 output. Since in the matlab function block, i have solved an differential equation, it has complex expressions in the form of for example .
This generates the output of complex data type from the function block. When passing this to the integrator which is the input to my plant, I cannnot run the simulink due to the error
"Cannot pass the complex value to non-complex location"
I tried chaning the data types of integrator, then the same thing happens to other blocks in the simulink.
I also tried using absolute values, which ofcourse gives real number, but turns out to be very large numbr and genrates high magnitude. I really need help in solving this issue.
Can anyone help me in this? Please
Thanks in advance.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!