How to receive user input as a string data type?

조회 수: 15 (최근 30일)
klughaft
klughaft 2019년 1월 30일
댓글: klughaft 2019년 1월 31일
Hello,
I am creating a GUI program (with GUIDE). In it, I need to ask the user to add comments to a file before it is exported.
I would like to have a dialog box where the user can insert a text that is as long as they wish, and that text might also include carriage returns.
I think that the best way to save this text, is as the new String data type. It appears that none of the input dialog box functions can accomodate strings, but rather chars.
Any suggesstions?
Thanks in advance!

답변 (1개)

KSSV
KSSV 2019년 1월 30일
a = input('Enter value:','s');
  댓글 수: 1
klughaft
klughaft 2019년 1월 31일
Thank you KSSV, but this is not what I am looking for:
  1. "input" is not a GUI function.
  2. It returns a char vector and not a string.
  3. The user cannot use the return key as a carriage return.

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

카테고리

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