Subsystem にある信号名を直接コマンドで取得できますか?
25 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 25 de Oct. de 2013
Respondida: MathWorks Support Team
el 25 de Oct. de 2013
Subsystem 内のInportブロックの名前ではなく、Subsystemに表示されている文字列を直接取得する方法があれば教えてください。
Respuesta aceptada
MathWorks Support Team
el 25 de Oct. de 2013
Subsystem のブロックプロパティには、ポートの名前を文字列として持っているプロパティはありません。ブロックプロパティに 'ShowPortLabels'というプロパティがあり、デフォルトでは'FromPortIcon' となっていることから、ポートから情報を取得して表示しています。そのため、Inport・Outportブロックから文字列を取得することで、Subsystem にあるポート名が取得できます。
デモモデル f14 の Subsystemブロック(Controller)について、ポートに表示される文字列を取得するコマンドの一例を紹介します。下記コマンドを実行することで動作が確認できます。
subsys = 'f14/Controller';
open_system('f14')
in_bh = find_system(subsys,'BlockType','Inport');
for l = 1:length(in_bh)
in_name = get_param(in_bh(l),'Name')
end
out_bh = find_system(gcb,'BlockType','Outport');
for l = 1:length(out_bh)
out_name = get_param(out_bh(l),'Name')
end
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!