关于输入数据部分出现了点问题
突然被要求做一个matlab界面 三个多星期了,在这个论坛学习了很多东西,有所进步但是其实最基本的东西还是不会。对matlab认识不够,本来想自己慢慢学习,可是已经没有时间了,所以来这里问问大家本来的界面是这个样子的:
function edit_Capacitor_Callback(hObject, eventdata, handles)
% hObject handle to edit_Capacitor (see GCBO)
% eventdatareserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.value.NumofPara_Capacitor = str2double(get(handles.edit_Capacitor,'string'));
str = '';
for i=1:handles.value.NumofPara_Capacitor
if (i<10)
str = ];
else
str = ];
end
end
set(handles.popupmenu_Capacitor,'string',str);
handles.value.CapacitorValue = ones(1,handles.value.NumofPara_Capacitor);
guidata(hObject,handles)
%popupmenu部分
function popupmenu_Capacitor_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu_Capacitor (see GCBO)
% eventdatareserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Temp = str2double(get(handles.edit_CapacitorValue,'string'));
handles.value.CapacitorValue(1,handles.value.PopCapacitor) = Temp;
handles.value.PopCapacitor = get(hObject,'Value');
set(handles.edit_CapacitorValue,'string',handles.value.CapacitorValue(1,handles.value.PopCapacitor));
guidata(hObject,handles)
%save 部分
handles.value.PopCapacitor = get(handles.popupmenu_Capacitor,'Value');
handles.value.CapacitorValue(1,handles.value.PopCapacitor) = str2double(get(handles.edit_CapacitorValue,'string'));
fprintf(fid,'%s',['Capacitor(F)']);
fprintf(fid,'%d',handles.value.NumofPara_Capacitor);
fprintf(fid,'%f ',handles.value.CapacitorValue*1e-6);
fprintf(fid,'\n');
这一系列的参数输入中 最前边的框是输入参数个数的 然后 popupmenu控制 value1 value2.....然后每个分别输入数据
但是现在前边参数个数如果 从大往小改的话 后边popupmenu 里必须手动选择到比较小的 数值 要么那个按钮就不显示了 因为新输入参数个数不包括那个东西。。现在还没有好的思路 ,如果有会的朋友给点帮助吧
页:
[1]