필터 지우기
필터 지우기

Use struct to set symbolic dimension of Simulink bus element

조회 수: 3 (최근 30일)
Khushal Ashok Bhatija
Khushal Ashok Bhatija 2023년 7월 26일
답변: Ishu 2024년 4월 3일
Hello,
I am trying to use a struct available in my model's data dictionary to symbolically set the dimension of a bus element. Below are the lines of code I am using
myBusElements(1) = Simulink.BusElement;
myBusElements(1).Name = 'myElement';
myBusElements(1).Dimensions = 'myDataDictionaryObject.myBusElementSize';
myBus = Simulink.Bus;
myBus.Elements = myBusElements;
Here is the error message I get
The 'Dot' operation is not supported as part of a symbolic dimension.
'myDataDictionaryObject.myBusElementSize'
^ To disable symbolic dimension propagation, clear 'Allow symbolic dimension specification' parameter in
the Configuration Parameters dialog box.
Any way to work around this? using a struct is a rigid requirement that I cannot ignore unfortunately as the struct in the data dictionary can change between model build and model run
Thanks!

답변 (1개)

Ishu
Ishu 2024년 4월 3일
Hi Khushal,
I understand that you are trying to set the "Dimensions" property of "Simulink.BusElement" as a variable. You can use this method to set the parameters of other blocks like "Constant", "Gain" but this method is not supported for "Simulink.BusElement" that's why you are getting error.
To set "Dimesnions" you can follow below approach:
% ddPath - Path to your dictionary
dd = Simulink.data.dictionary.open(ddPath); %Open your dictionary
ddSection = getSection(dd, 'Design Data');
ddEntry = getEntry(ddSection, 'myDataDictionaryObject');
myStruct = getValue(ddEntry) % get the struct
myBusElementSize = myStruct.myBusElementSize; % get the dimension for bus element
myBusElements(1).Dimensions = myBusElementsize; %set the dimension
For more information on "Simulink.BusElement" you can refer below documentation:
Hope it helps!

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by