How to change data dictionary entry through matlab script without altering the storage class?
54 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sachin Ganesh Uma Maheswaran
el 9 de Dic. de 2021
Editada: Shashwat Singh
el 8 de Ag. de 2023
Hi,
I am trying to change multiple entries in the data dictionary for a particular model. Instead of copy pasting every time, I would like to create a script for doing this automatically everytime. This is the script I am using right now:
BPPR_sldd = Simulink.data.dictionary.open('BPPR_ac.sldd');
dDataSectObj = getSection(BPPR_sldd,'Design Data');
a = getEntry(dDataSectObj,'KtBPPR_I_I2chr');
setValue(a,single(cal_I2c));
The issue here is that when I do this the parameter changes its storage class and becomes a generic constant when setValue is used. See figure for reference:
0 comentarios
Respuestas (1)
Donn Shull
el 23 de En. de 2022
Do not cast the DataType during the assignment.for example:
>> x = Simulink.Parameter
x =
Parameter with properties:
Value: []
CoderInfo: [1×1 Simulink.CoderInfo]
Description: ''
DataType: 'auto'
Min: []
Max: []
Unit: ''
Complexity: 'real'
Dimensions: [0 0]
The DataType is 'auto'. Assign the value:
>> x.Value = 12
x =
Parameter with properties:
Value: 12
CoderInfo: [1×1 Simulink.CoderInfo]
Description: ''
DataType: 'auto'
Min: []
Max: []
Unit: ''
Complexity: 'real'
Dimensions: [1 1]
The DataType is unchanged. Assign the value using a cast:
>> x.Value = uint16(12)
x =
Parameter with properties:
Value: 12
CoderInfo: [1×1 Simulink.CoderInfo]
Description: ''
DataType: 'uint16'
Min: []
Max: []
Unit: ''
Complexity: 'real'
Dimensions: [1 1]
The DataType changes to 'uint16'.
1 comentario
Shashwat Singh
el 8 de Ag. de 2023
Editada: Shashwat Singh
el 8 de Ag. de 2023
How to alter the Storage class of 'Simulink.Parameter' programatically???
Ver también
Categorías
Más información sobre Manage Design Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!