Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将数据从一个gui matlab传输到另一个gui matlab的编辑框_Matlab_User Interface - Fatal编程技术网

如何将数据从一个gui matlab传输到另一个gui matlab的编辑框

如何将数据从一个gui matlab传输到另一个gui matlab的编辑框,matlab,user-interface,Matlab,User Interface,我在matlab中有两个gui,分别命名为main和sub。我通过subgui中的按钮对图像进行一些计算,并希望将结果(handles.sh和handles.sv)传输到主gui的编辑框中,这些结果应在编辑框中以单独的行显示。我使用了setappdata和getappdata,但它不起作用,也没有显示任何内容,或者更可能是我犯了错误 主gui的编辑框回调 function edithistory_Callback(hObject, eventdata, handles) % hObject

我在matlab中有两个gui,分别命名为main和sub。我通过subgui中的按钮对图像进行一些计算,并希望将结果(
handles.sh
handles.sv
)传输到主gui的编辑框中,这些结果应在编辑框中以单独的行显示。我使用了
setappdata
getappdata
,但它不起作用,也没有显示任何内容,或者更可能是我犯了错误

主gui的编辑框回调

function edithistory_Callback(hObject, eventdata, handles)
% hObject    handle to edithistory (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.sh =  getappdata(0,'horizontal');
set(hObject,'String',num2str(handles.sh));
handles.sh =  getappdata(0,'vertical');
set(hObject,'String',num2str(handles.sv));
subgui的按钮回调

Bw    =  im2bw(handles.D);

s     =  regionprops(Bw, handles.D, 'Centroid');
handles.sx  =  round(s.Centroid(1));
handles.sy  =  round(s.Centroid(2));
handles.roi =  handles.roi/2;
i     =  (handles.sx-((handles.roi)-1)):(handles.sx+ handles.roi);
j     =  (handles.sy-((handles.roi)-1)):(handles.sy+ handles.roi);
  ROI   =  (handles.D(i,j));     
      ROI   =  (2^16)-ROI;
      avg   =  sum(ROI(:))/((2*handles.roi).^2);
     profileh1 = (handles.D(handles.sx,:));
  profileh  = (2^16-profileh1);
 profileh(1)=  profileh(2);
FieldSizeh  =  profileh(profileh>=avg*0.5);
FieldSizeh(:)  =avg;
 handles.sh = (size(FieldSizeh,2)*0.25);
 setappdata(0,'horizontal',handles.sh);
profilev1   =  handles.D(:,handles.sy);
  profilev  = (2^16-profilev1);
 profilev(1)=  profilev(2);    
FieldSizev  =  profilev(profilev>=avg*0.5);
FieldSizev(:)=avg;
 handles.sv = (size(FieldSizev,1)*0.25);
 setappdata(0,'vertical',handles.sv);

点击
subgui
中的按钮后,您是否真的触发了
edithistory\u回调
?不,我该怎么做?点击
subgui
中的按钮后,您真的触发了
edithistory\u回调
?不,我该怎么做?