Why I get this error of matrices not consistent? What's wrong?

조회 수: 1 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2019년 1월 30일
댓글: Guillaume 2019년 1월 30일
I am trying to use that code
message = ({'Welcome, XXXXXXX';'I hope to Enjoy it' ; 'Please, share it' ; 'Cheers!'});
myicon = imread('maer.jpg');
waitfor(msgbox(message,myicon));
But I get the error
Dimensions of matrices being concatenated are not consistent.
Error in msgbox (line 182)
MsgboxTag = ['Msgbox_', TitleString];
Error in ruller (line 3)
waitfor(msgbox(message,myicon));
What matrices need to be same dimensions? The message and the image?
Following the guidelines here
Seems so easy. Please help!!

채택된 답변

Guillaume
Guillaume 2019년 1월 30일
The icon is the 3rd input of msgbox, not the second. In fact, if you want to specify a custom icon, you've used the completely wrong syntax
I agree that the error is rather obscure, it would be better if msgbox checked that the 2nd input was valid. msgbox was expecting a one row input as the 2nd argument.
To specify a custom icon:
msgbox(message, 'some title', 'custom', myicon)
  댓글 수: 6
Stelios Fanourakis
Stelios Fanourakis 2019년 1월 30일
Neither of those lines actually work
hfig.Children(2).myicon = hfig.Children(2).myicon *2;
hfig.Children(3).message = hfig.Children(3).message *2;
Guillaume
Guillaume 2019년 1월 30일
Why should they? I never suggested that.
As I said, it's probably simpler to build a GUI from scratch that is already as you want rather than resizing an existing figure and all the children.
As I said, hfig.Children(2) should be an axes. axes don't have a myicon property. The icon is the Children of that axes (so hfig.Children(2).Children). This will be an Image object. Multiplying an Image is meaningless. You would have to resize it and change its position. Possibly alter the CDataMapping property as well.
Similarly for the Text object (hfig.Children(3).Children), you'll have to change the position and FontSize property as well.
You may find it easier to find out which properties to edit in the figure hierarchy using the property editor. To get the property editor:
propertyeditor(hfig)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by