I have created a set of gui's and i have inserted next button to navigate to the next gui. in the next gui i have a load button and an axes to display the image but if i select an image it gives me an error. the error is displayed below.
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
Attempt to reference field of non-structure array.
Error in LBPFeature>pushbutton1_Callback (line 84) axes(handles.axes1)
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in LBPFeature (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)LBPFeature('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
What can i do to display the image? if i open each gui individually i can load the image but if i navigate im not able to load the image. Please help me
댓글 수: 1
[filename pathname]=uigetfile({'*.bmp';'*.jpg'},'File Selector'); image=strcat( pathname, filename) axes(handles.axes1) imshow(image)
This is the code used to load an image.. and the error is in "axes(handles.axes1)" how can i fix this error?
채택된 답변
It doesn't know what handles.axes1 is. First use h = findobj('Tag',axes1) and then axes(h). I think it should work.
댓글 수: 25
Undefined function or variable 'axes1'. i got this error after trying the above mentioned method
what do i do now? can u help me?
I am sorry add axes1 in quotes 'axes1' Like
h = findobj('Tag','axes1')
By the way I hope axes1 is the tag for your axes. Just check it once in the Property Inspector.
Yes axes1 is the tag for it. Thanks alot it worked:) :) and one more question..i have used 4 axes in a single gui and two gui's are there of such type. if i apply the same logic does it work?
Now i have the same problem but it is for the edit text field
my code is set(handles.edit1,'String',num2str(h_dist1)); set(handles.edit2,'String',num2str(h_dist2)); set(handles.edit3,'String',num2str(h_dist3));
error is Attempt to reference field of non-structure array.
Error in LBPFeature>TestingLBP_Callback (line 268) set(handles.edit1,'String',num2str(h_dist1));
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in LBPFeature (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)LBPFeature('TestingLBP_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
The same logic applies for any graphic object(editbox,listbox,buttons). You can first find the editbox using findobj and then set the string value.
ok how do i write the code is this correct?
a=findobj('Tag','edit1'); edit1(a);
when i press the push button the values computed by h_dist1,2,3 should be displayed on the edit box 1,2 and 3 respectively..so is the above code correct?
a = findobj('Tag','edit1');
set(a,'String',num2str(h_dist1));
Thanks alot it works like a charm :) :) :) if u dont mind one more question in my gui when i press the close button or back button the current gui should close completely and open the specified gui
i have used the following code.. close(LBPFeature) open FeatureMethods.fig
but the LBPFeature gui doesnt close it flashes and opens again what is the solution for this?
That's strange. Try close(gcf). Since LBPFeature is your current figure.
Thanks alot:) :) U made my day :) :) :) Thank you answering quickly and everything worked :) :)
Can i know how to change the color of the string that i display in edit text box? i need to print YES in Green and NO in red how can i do this?
Use Foreground Color in the same set command. Also, check Color Properties because there are different rgb values you have to give to this Property. Just check the property inspector and you will be amazed to see how many things you can do.
sorry for the wrong question. my question is i have set a value for h_dist variable..if the generated value exceeds the set value i wanna print NO(in red color) and if it is less than that it should print YES(in green color). both yes and no can appear in the edit box. How to do this? Any idea?
Yes, it can be done using set command. Following the same set of commands you have used till now. Just there will be an if else statement too.
set(g,'Color','r');
is this right?
g is the color and r is the variable in which i have stored the string
There is no Property called 'Color' for edit text. set(g,'Foreground Color','r'); I am not sure about the 'r'. Check the Color Properties.
Thank you will check it out :) :) :)
it working for a rectangle.
if i type this set(r,'edgecolor','g'); its showing me a rectangle with green edges..
but not able to set the Text color
For Text Color its Foreground Color that you have to set.
Yes i have tried "set(a,'ForegroundColor','r');" it buy it shows me the following error
Error using set Value must be a handle
Error in LBPFeature>TestingLBP_Callback (line 298) set(a,'ForegroundColor','r');
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in LBPFeature (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)LBPFeature('TestingLBP_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
>>
Is there any other method to set the text color?
I searched for it. It won't be possible to do it in the Callback function of your edit text. YOu can do it in another Keypressfcn. But I still am not sure if 'Color' would work with set. Sorry, couldn't be of more help. Post it in another thread. Maybe someone will know the answer.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
