Variable number of inputs in inputdlg with pre-selected values when inputs equals 6
Sometimes I want to replace the column headings in a uitable. I have several uitables and each can have a variable number of columns so I have the following code which uses an inputdlg but with a variable number of inputs.
T=app.UITable;
data=T.Data;
[rows,cols]=size(data)
ReportMessage(app,[‘UITABLE cols: ‘,num2str(cols)]);
dlgtitle = ‘Modify Columns Headings….’;
prompts=compose(‘Col %d’,1:cols);
y=inputdlg(prompts,dlgtitle);
T.ColumnName=y;
When the number of columns is 6, I want to pre-select the input entries. Normally I would use this
definput = {‘100′,’1′,’31.72′,’0′,’123′,’78’};
But this doesn’t work
if cols==6
prompts=compose(‘Col %d’,1:cols);
definput = {‘100′,’1′,’31.72′,’0′,’123′,’78’};
y=inputdlg(prompts,dlgtitle,definput);
end
T.ColumnName=y;
But this doesn’t workSometimes I want to replace the column headings in a uitable. I have several uitables and each can have a variable number of columns so I have the following code which uses an inputdlg but with a variable number of inputs.
T=app.UITable;
data=T.Data;
[rows,cols]=size(data)
ReportMessage(app,[‘UITABLE cols: ‘,num2str(cols)]);
dlgtitle = ‘Modify Columns Headings….’;
prompts=compose(‘Col %d’,1:cols);
y=inputdlg(prompts,dlgtitle);
T.ColumnName=y;
When the number of columns is 6, I want to pre-select the input entries. Normally I would use this
definput = {‘100′,’1′,’31.72′,’0′,’123′,’78’};
But this doesn’t work
if cols==6
prompts=compose(‘Col %d’,1:cols);
definput = {‘100′,’1′,’31.72′,’0′,’123′,’78’};
y=inputdlg(prompts,dlgtitle,definput);
end
T.ColumnName=y;
But this doesn’t work Sometimes I want to replace the column headings in a uitable. I have several uitables and each can have a variable number of columns so I have the following code which uses an inputdlg but with a variable number of inputs.
T=app.UITable;
data=T.Data;
[rows,cols]=size(data)
ReportMessage(app,[‘UITABLE cols: ‘,num2str(cols)]);
dlgtitle = ‘Modify Columns Headings….’;
prompts=compose(‘Col %d’,1:cols);
y=inputdlg(prompts,dlgtitle);
T.ColumnName=y;
When the number of columns is 6, I want to pre-select the input entries. Normally I would use this
definput = {‘100′,’1′,’31.72′,’0′,’123′,’78’};
But this doesn’t work
if cols==6
prompts=compose(‘Col %d’,1:cols);
definput = {‘100′,’1′,’31.72′,’0′,’123′,’78’};
y=inputdlg(prompts,dlgtitle,definput);
end
T.ColumnName=y;
But this doesn’t work inputdlg MATLAB Answers — New Questions