Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.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
在Matlab中动态创建文本框_Matlab_Textbox_Dynamically Generated - Fatal编程技术网

在Matlab中动态创建文本框

在Matlab中动态创建文本框,matlab,textbox,dynamically-generated,Matlab,Textbox,Dynamically Generated,我使用指南允许用户从其硬盘中选择文件,将其加载到列表中,并将加载文件的名称和内容填充到文本框中 到目前为止,我已经准备好将文件加载到列表中。我确实找到了一种方法,可以根据加载的文件数量创建适当数量的文本框。以下是我的脚本: function pushbutton1_Callback(hObject, eventdata, handles) % Get file file names from loading directory/folder filename= uigetfile('*.dat

我使用指南允许用户从其硬盘中选择文件,将其加载到列表中,并将加载文件的名称和内容填充到文本框中

到目前为止,我已经准备好将文件加载到列表中。我确实找到了一种方法,可以根据加载的文件数量创建适当数量的文本框。以下是我的脚本:

function pushbutton1_Callback(hObject, eventdata, handles)

% Get file file names from loading directory/folder
filename= uigetfile('*.dat', 'Multiselect','on');

% Show all profi files names in the listbox
set(handles.listbox1,'String',filename);

% Reset selection for all loaded files
for k = 1:length(filename)
set(handles.listbox1,'Value',k);

empty_panel = get(handles.uipanel2,'Tag');
number = length(filename);
for jj = 1:number
    textEl(jj) = uicontrol('Parent', empty_panel, 'Style', ... 
                'text','test','Position', [0 (jj-1)*30, 100, 20]);
end
我之前创建了一个面板(uipanel2)、一个按钮(按钮1)和一个列表框(列表框1)。我收到以下错误消息:

 Error using uicontrol
 Invalid convenience arg handle

 Error in plot_profi_V2>pushbutton1_Callback (line 124)
     textEl(jj) = uicontrol('Parent', empty_panel, 'Style', ...
                'text','test');%'Position', [0 (i-1)*30, 100, 20]);

两天后,我发现了问题,以下是供将来参考的脚本:

function pushbutton1_Callback(hObject, eventdata, handles)

% Get file file names from loading directory/folder
filename= uigetfile('*.dat', 'Multiselect','on');

% Show all profi files names in the listbox
set(handles.listbox1,'String',filename);

% Reset selection for all loaded files
for k = 1:length(filename)
set(handles.listbox1,'Value',k);

empty_panel = get(handles.uipanel2,'Tag');
number = length(filename);
for jj = 1:number
    textEl(jj)= uicontrol(handles.uipanel2,'Style','text','String',filename{jj}, ...
                     'Units','normalized','Position',[jj/10-0.1 0.9 0.1 0.1]);
end

'test'
没有与之关联的有效属性名。@excaza'test'与样式“text”关联还是我误解了你的问题?那是无效的syntax@excaza让它工作的正确语法是什么?要么删除它,要么实际指定您试图设置它的任何属性为什么在您提出问题后不到一个小时我就给了您两天的时间来找到问题?因为即使在我请求指导。但最重要的是,我设法使它工作,现在它可以在网上为任何其他人。如何“指定您试图设置的属性”含糊不清?