Hi
I would like to display til following matrix in a msgbox, so they are placed nicely is in a normal matrix.
I found this code, but the values are not writtes as in a matrix, but more link in a txt file.
if somebody knows how to fix this, I would be happy!
if true
MGF =
7 7 4 7
12 10 10 12
-3 7 2 -3
10 12 12 12
7 4 10 10
12 12 10 12
0 -3 2 -3
7 10 7 10
12 12 12 12
5 13 8 10
12 NaN NaN 12
msgbox(num2str(MGF))
end

 채택된 답변

Stephen23
Stephen23 2018년 1월 11일

0 개 추천

Use the correct tool: uitable
Or you might be able to change the typeface (font) to a monospaced one.

추가 답변 (3개)

Pawel Jastrzebski
Pawel Jastrzebski 2018년 1월 11일
편집: Pawel Jastrzebski 2018년 1월 11일

0 개 추천

Your MGF isn't a matrix. Encompass it with [] and ; for row separation and it should work. See the example below:
m = randi(5,6)
msgbox(num2str(m))
Signe Carlslund Kristensen
Signe Carlslund Kristensen 2018년 1월 11일

0 개 추천

thanks for your answer.
But when i do is you write is the result as on the picture, and then it again looks like something that could be from a .txt file. Do you know how to fix this?

댓글 수: 1

Pawel Jastrzebski
Pawel Jastrzebski 2018년 1월 11일
I don't think it's possible to have the matrix values perfectly aligned in the message box. But if you think about it, message box is a 'Figure' object. So instead of using 'msgbox', plot your data with i.e. heatmap and remove all of the formatting and you'll achieve the same result.

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

Signe Carlslund Kristensen
Signe Carlslund Kristensen 2018년 1월 12일

0 개 추천

thank you så much to both of you! it worked with uitable :-)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by