필터 지우기
필터 지우기

message length

조회 수: 2 (최근 30일)
Vino
Vino 2012년 4월 30일
HOw to display the length of message given which is given as input in the message box?
  댓글 수: 1
Jan
Jan 2012년 4월 30일
What is "the message box"? What means "input" here? Which "length" do you want: The number of characters or the width when displayed on the screen considering the font and line wrapping?

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

채택된 답변

Titus Edelhofer
Titus Edelhofer 2012년 4월 30일
Hi Vino,
if you do
edit msgbox
you will see at line 274 (at least in R2012a I'm looking at) a call to textwrap with argument 75. So: msgbox will make the box as large as to fit the string you entered, but if it will be too long, it will be broken such that it is 75 characters at most. Of course you could call textwarp yourself before calling msgbox if you want to have less characters in a row.
Titus
  댓글 수: 3
Jan
Jan 2012년 5월 4일
The size of the message box is increased automatically. But you can call the function textwrap by your own also. Another solution is using the FEX submission http://www.mathworks.com/matlabcentral/fileexchange/24871-autowarndlg . The largest part of the code cares for reshaping the message text until it fits nicely into a box.
Tom
Tom 2012년 9월 12일
hey,
I'm currently bothered by the 75 characters limit of the msgbox function aswell... Do you know if it's possible to use the textwrap function also to raise these 75 characters that the automatic textwrap does not occur. Or can I only use it to reduce the length of characters in a messagebox by textwrapping my 'string' before??
I hope that somebody can help me with my problem even if this is an old entry!

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

추가 답변 (1개)

Vino
Vino 2012년 5월 4일
cant we display numbers in msg box?
  댓글 수: 1
Titus Edelhofer
Titus Edelhofer 2012년 5월 4일
yes, you can: use e.g. num2str to convert to a string, e.g.
msgbox(['The answer is ' num2str(42) '.'])

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

카테고리

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