How to create stable axes on matlab gui
1 view (last 30 days)
Show older comments
I have created a matlab gui panel which is usefull for product configuration. I have too many tabs and in every tab I have some choises with pictures.in first step everything looks perfectly fine. But as you can see in the attachments when I restarted the program gui don't shows the images.. After I've been sure again to everything is o.k. (I click every CreateFcn of every axes) It works again. but only till the next restart. What am I doing wrong?
I write images code in axes_CreateFcn title, for exapmle;
function axes_Elektrischer_a_CreateFcn(hObject, eventdata, handles)
imshow(imread('C:\Users\***\Desktop\akbnamen\bilder\Elektrischer_a.png'));
set(hObject,'tag','axes_Elektrischer_a')
function axes_Elektrischer_b_CreateFcn(hObject, eventdata, handles)
imshow(imread('C:\Users\***\Desktop\akbnamen\bilder\Elektrischer_b.png'));
set(hObject,'tag','axes_Elektrischer_b')
5 Comments
Geoff Hayes
on 11 Apr 2020
You can specify the parent axes as a parameter to imshow (see imshow name value pairs for details). In your case, you would do something like the following in your OpeningFcn:
imshow(imread('C:\Users\***\Desktop\akbnamen\bilder\Elektrischer_a.png'), 'Parent', handles.axes_Elektrischer_a);
imshow(imread('C:\Users\***\Desktop\akbnamen\bilder\Elektrischer_b.png'), 'Parent', handles.axes_Elektrischer_b);
You don't need to set the Tag of the axes as that should already be set with the name of the axes.
Accepted Answer
Geoff Hayes
on 13 Apr 2020
fatih - You can specify the parent axes as a parameter to imshow (see imshow name value pairs for details). In your case, you would do something like the following in your OpeningFcn:
imshow(imread('C:\Users\***\Desktop\akbnamen\bilder\Elektrischer_a.png'), 'Parent', handles.axes_Elektrischer_a);
imshow(imread('C:\Users\***\Desktop\akbnamen\bilder\Elektrischer_b.png'), 'Parent', handles.axes_Elektrischer_b);
You don't need to set the Tag of the axes as that should already be set with the name of the axes.
0 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!