MATLAB Answers

Update a gui table based on the input number given

6 views (last 30 days)
Vasista Adupa
Vasista Adupa on 23 Jul 2020
Hi, I want to create a table of a certain size. Lets say rows are based on a number which I need to give input to the app. and the column is fixed. only one for now.
Is this possible. For now I created manually by writing 5 times the same code .. Please help me getting through this.
Please find the attachment of the mlapp file.
I am thinking to add a for loop for this section to automate it.
v = evalin("base",'original_proj_list'); % To import a variable from our workspace
v = ['Select';v(:,1)];
roll_nos = xlsread("./name_CGPA_2.xlsx");
roll_nos = ['Select';string(roll_nos(:,1))];
%for i = 1 : length(roll_nos)
app.StudentInfoDropDown.Items.i = roll_nos;
app.ProjectInfoDropDown.Items.i = v(:,1);
app.StudentInfoDropDown_2.Items = roll_nos;
app.ProjectInfoDropDown_2.Items = v(:,1);
app.StudentInfoDropDown_3.Items = roll_nos;
app.ProjectInfoDropDown_3.Items = v(:,1);
app.StudentInfoDropDown_4.Items = roll_nos;
app.ProjectInfoDropDown_4.Items = v(:,1);
app.StudentInfoDropDown_5.Items = roll_nos;
app.ProjectInfoDropDown_5.Items = v(:,1);
%end

Answers (1)

Harsha Priya Daggubati
Harsha Priya Daggubati on 27 Jul 2020
Hi,
You can dynamically create a table when '#rows' are given as input in your app. This can be done by placing the code to create a table in the callback associated with the button that has to be clicked when '#rows' are entered.
For proper syntax to create a table:
This example might help you too!
I couldn't make sense of the code, where you are trying to populate every dropdown with same variables 'rollnos'. I can only help you, if you can elaborate on what you wanted to achieve.
Hope this helps!

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!