我使用GUIDE进行编码。我想从handles.edit1
获得数据输入,。。。handles.edit8
并保存到变量handles.in(1,1)
,。。。handles.in(1,8)
。我的代码在下面,我得到一个错误:
找不到字符串类的"get"方法。
edit = ["handles.edit1","handles.edit2","handles.edit3","hanles.edit4","handles.edit5","handles.edit6","handles.edit7","handles.edit8"]
for i = 1:1:8
handles.in(1,i) = str2num(get(edit(1,i),'string'));
end
您应该更改
edit = ["handles.edit1","handles.edit2","handles.edit3","hanles.edit4","handles.edit5","handles.edit6","handles.edit7","handles.edit8"]
至
edit = [handles.edit1,handles.edit2,handles.edit3,hanles.edit4,handles.edit5,handles.edit6,handles.edit7,handles.edit8];