Reputation: 149
I think, I got a rather easy question, but I haven't found any solutions so far.
How can I change the standard data types of a simulink model? The model contains some matlab function blocks
and within this blocks I want that e.g. a variable like var = zeros(10,10)
should have data type single
instead of double
.
I know, I can set the data type by declaring var = zeros(10,10,'single')
, but the model exists already and I dont want to change every declared variable manually. I think, there must be an option at the model properties.
I hope, you can help me out!
Upvotes: 0
Views: 3038
Reputation: 104
It could by possible by changing the parameter "Default for underspecified data type"
(DefaultUnderspecifiedDataType
) in the Optimization category inside the Configuration Parameters of your model to single
.
I'm not sure if it affects MATLAB function blocks, though.
Upvotes: 1
Reputation: 10772
There is no global "use this data type" setting. Simulink will use the data types of the variables you use as parameters, and the setting for each individual block for signals.
However, for block outputs, most blocks will inherit their output data type from their inputs, so you can set the data type at the most upstream block and downstream blocks will use it.
There is some functionality within the Fixed-Point tools to override block setting and simulate everything as double, but it doesn't sound as if that'll be of any use to you.
Upvotes: 2