필터 지우기
필터 지우기

How can I fill in a matrix with the data of a multiline edittext box?

조회 수: 1 (최근 30일)
sadel
sadel 2013년 11월 19일
댓글: sadel 2013년 11월 20일
Hello, I have a gui with a multiline edittext box and I want for example to write on three lines 9 numbers (3 numbers on each line) and to create a 3x3 matrix. How can I do that? I know that an edittext box get strings but how can my program count the written lines of my edittext, and then create a matrix with the transformed strings to numbers?
kind regards!

채택된 답변

Walter Roberson
Walter Roberson 2013년 11월 19일
get(EditBoxHandle, 'String') is going to return a cell array of strings. length() of the cell array will tell you how many lines there are.
You will need to convert the strings to numbers. See sscanf()
  댓글 수: 1
sadel
sadel 2013년 11월 20일
Thank you for your answer, instead of sscanf() I used the str2num(). The results were a little bit better.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Word games에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by