getting one line from unknown amount of lines (gui)

조회 수: 2 (최근 30일)
reuven reuven
reuven reuven 2019년 4월 11일
댓글: reuven reuven 2019년 4월 12일
hi.
i am building assembly simulator in gui and i need help ,
how do i get only one line from unknown amont of lines into one variable.
i know i can do it with get function, but with this function i get all the text in "edit text" window into variable.
one more question,
how can i disassemble the sentence? so i can work with the words.
  댓글 수: 7
TADA
TADA 2019년 4월 12일
So you're basically building a parser... Like Bob nbob says, regexp is your friend in these situations
You can divide the lines of code to an array of lines with:
lines = splitlines(str);
For this example you can use a fairly simple regexp to split the string to command and parameters, using named groups in your pattern and this formalism:
data = regexp(string, pattern, 'names');
Can be very convenient for extracting stuff from strings
reuven reuven
reuven reuven 2019년 4월 12일
Thank you.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by