필터 지우기
필터 지우기

Get only block name from get() function

조회 수: 2 (최근 30일)
Ewela
Ewela 2021년 10월 27일
답변: Ayush Modi 2024년 3월 7일
How can I get only the name of the block without the port number?
I have this line:
blockname_and_portnum = get(line_connection_handler,'SourcePort');
and it gives me:
Step:1
but I need only Step. I want to get this without any extractBefore functions for code optimization. It is possible to get only block name from the function get()?

답변 (1개)

Ayush Modi
Ayush Modi 2024년 3월 7일
Hi Ewela,
There is no direct way to get the block name from a line handler without using any string manipulation functions in MATLAB. The block name and port number are typically returned as a single string, so some form of string manipulation is necessary to extract just the block name.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by