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 についてさらに検索
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
