MATLAB Answers

0

How can I select 2 columns from each option of a pop menu when I press the load button from a .csv file

Asked by Gemma Malagón on 9 Aug 2019
Latest activity Answered by Harsha Priya Daggubati on 13 Aug 2019
Hi, I have the following options at pop menu: R ANTD, R POST D, R PECM, R BIC, R TRI, L ANTD, L POST D, L PECM, L BIC, L TRI.
How can I write a code that selects 2 different columns of numbers from a .csv file for each pop menu, every time I press a pussh button?

  0 Comments

Sign in to comment.

2 Answers

Answer by Harsha Priya Daggubati on 12 Aug 2019

Can you elaborate your concern.As far as I understand your GUI has one pushbutton and a pop menu with 10 options. What exactly do you want to do when a push button is clicked?

  1 Comment

Yes, thank you. What I want to do is after I select one option of the pop menu (10 options in total) and then I press the load button to load a .csv file a graph plots the first 2 columns if I select the 1st option of the menu. Then if I select option 2 I want it to plot columns 9 and 10, then fro option 3 I want it to plot columns 17 and 18, and so on for the rest of the options of the popmenu.

Sign in to comment.


Answer by Harsha Priya Daggubati on 13 Aug 2019

Hi,
You can read a column from a ‘.csv file’ using readmatrixfunction in MATLAB. Refer to this documentation link for more detail:
For Example, this code reads the 1st column of data with 4 rows
readmatrix('csvfilename.csv','Range',[1,1,4,1]);
You can add the code in ValueChangedFcn Callback of Pop-up menu.

  0 Comments

Sign in to comment.