Automating Signal Storage Class in M script

How do I specify the storage class for a signal in m script? I would like to automate this process. For example, under signal properties-->RTW-->Storage Class....I would like to set the signal to Imported Extern.
Thanks in advance!

 채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 4월 16일

0 개 추천

If you already have a Simulink.Signal object associated with the relevant signal line, then you can use code similar to what Titus suggested (just switch Simulink.Parameter with Simulink.Signal). But if you just want to operate directly on a named signal, and have the handle to the signal, you can set it using the "RTWStorageClass" property. For example, using a demo model called "busdemo":
open_system('busdemo');
ph = get_param('busdemo/Bus Creator', 'PortHandles');
set(ph.Outport, 'RTWStorageClass', 'ImportedExtern');
(The last line will error out if you do not have a signal name, in which case you may set that using the SET command for the SignalName property)

추가 답변 (2개)

Titus Edelhofer
Titus Edelhofer 2012년 4월 14일

0 개 추천

Hi Brandon,
you set the properties with "dot" notation:
x = Simulink.Parameter;
x.Value = 2.0;
x.RTW.StorageClass = 'ImportedExtern';
The last command is probably not completely correct, because I have no MATLAB here to test ... The easiest is to typ x. and then Tab to get the list of "allowed" names.
Titus
Brandon
Brandon 2012년 4월 17일

0 개 추천

Perfect; thank you for both answers. I had just previously used Titus's example for creating globals for calibrations in my workspace. Kaustubha's answer is exactly what I'm looking for. Thanks again to the both of you

댓글 수: 1

Hi Brandon, sounds good. I would suggest to mark the question answered (by Kaustubha)...

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by