How to turn predefined values for inputdlg function into a cell array or character vector
10 views (last 30 days)
Show older comments
Hi all,
I would like to create an input dialog box with several parameters value to fulfill from the user. The pinions.txt file contains a list of these parameters, and a customer as first column, structured this way :
Customers,param1,param2,param3
CustomerA,valueA1,valueA2,valueA3
CustomerB,valueB1,valueB2,valueB3
I created a table out of this .txt file. I setted definput to already put the predefined parameters according to which customer is pre-selected in the listdlg function and not manually write them each time. These predefined parameters are located in the table in the row 'indx', which refers to the customer selected, and columns 2 to 9.
However, I don't know how to turn this piece of table definput to be a cell array or a character vector as requested.
Written this way, I get this error :
definput= Pinions{indx,[2:9]}
answer = inputdlg(prompt,title,dims,definput);
Error using inputdlg (line 112)
Default Answer must be a cell array of character vectors.
Here is the part of the code below :
Pinions = readtable('Pinions.txt')
%% Geometric variables definition
Appli = string(Pinions.Application);
width=width(Pinions)-1;
Variables = string(Pinions.Properties.VariableNames);
% Enter customer variables (involute serration data).
[indx,tf] = listdlg('PromptString','Select a customer reference :','SelectionMode','single','ListString',Appli);
if tf==0
msgbox('No application selected')
return
end
input_check = 0;
while input_check == 0
for i=1:width
prompt(i) = {Variables(i+1)};
title = 'Geometric variables definition';
dims=[1 40] ;
end
definput= Pinions{indx,[2:9]}'
answer = inputdlg(prompt,title,dims,definput);
Does anyone have a clue about this ? I hope to have been as clear as possible
Thanks !
Hadrien
0 Comments
Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!