フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I have a problem with some code of GUI

4 ビュー (過去 30 日間)
Farjana Yeasmin
Farjana Yeasmin 2014 年 11 月 30 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
from the 1st function embed_ok i want to use the m_length in the 2nd function in the position of retrieve(image_string,_) How can I do that ? _ is the expected position of m_length
function embed_ok_Callback(hObject, eventdata, handles)
% hObject handle to embed_ok (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
image_string=get(handles.image1,'String');
text_string=get(handles.text_file,'String');
[m_length,mes]=embed(image_string,text_string);
function retrieve_ok_Callback(hObject, eventdata, handles)
% hObject handle to retrieve_ok (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
image_string=get(handles.image2,'String');
retrieve(image_string,_);
  1 件のコメント
Image Analyst
Image Analyst 2014 年 11 月 30 日

回答 (1 件)

Geoff Hayes
Geoff Hayes 2014 年 11 月 30 日
Farjana - save m_length to the handles structure using guidata so that the other callback can access this data. For example, your first callback would become
function embed_ok_Callback(hObject, eventdata, handles)
image_string=get(handles.image1,'String');
text_string=get(handles.text_file,'String');
[m_length,mes]=embed(image_string,text_string);
% save the length
handles.m_length = m_length;
guidata(hObject,handles);
Then in your second callback, just reference this field of handles as
handles.m_length
though you may want to add a guard to ensure that thus field exists before trying to see it.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by