How to assign a menu selection to a column in a matrix?

>IF
A = [2012, 4000, 1200; 2013, 1850, 2100; 2009, 2300, 1100]
B = [H104GX, 8HX001S]
>WHERE
column 1 of matrix A represents years
column 2 represents DeviceID "H104GX"
column 3 represents DeviceID "8HX001S"
each row represents the production values for that DeviceID for that year.
H104GX 8HX001S
2012 *4000* *1200*
2013 *1850* *2100*
2009 *2300* *1100*
*THE VALUES OF MATRIX B ARE DISPLAYED ON MATRIX A FOR CLARIFICATION. THEY DO NOT BELONG TO THE MATRIX.
The values that are bolded represent production values.
>THEN, how do I assign the first value in variable B to the second column of variable A and the second value in variable B to the third column of variable A when using the menu function.
I have created two menus. The first menu displays the values from column 1 of matrix A and asks the user to select a value. The second menu displays the values of matrix B and asks the user to select a value. The goal is to take the two values that the user inputs and output a production value based on the year and DeviceID selected.

4 comentarios

Stephen23
Stephen23 el 8 de Sept. de 2018
Editada: Stephen23 el 8 de Sept. de 2018
@Andrew Padilla: the answer is to either use indexing or use a table, just like when you asked the same question three days ago. How is this question any different to the one that you asked earlier?:
Andrew Padilla
Andrew Padilla el 8 de Sept. de 2018
Editada: Andrew Padilla el 8 de Sept. de 2018
Sorry for the confusion. This question is different, because if I use the menu function to prompt the user to select a year and DeviceID then the output for the year will be correct, however, the device ID will be incorrect because the DeviceID array should start at the second column of the production matrix not the first. When the user selects a year and a device id, it assumes the first device ID is for column 1 and the second device ID is for column 2. It should be that the first device ID corresponds to column 2 and the second divide ID to column 3 of the production matrix.
Show the code you used to create the menus. Do you want to display the numbers in a table (uigrid) and then get a popup menu when you right click on the first column but not when you right click on the second column? If so, sounds like a question for Yair: http://undocumentedmatlab.com/
LINE 31: The value is selected based on the choice values which are acquired from the user selecting values from the menus. If I dont include a blank value in the "DeviceID" array, then it won't align with the Prod array because the device id is supposed to begin at column 2.

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 7 de Sept. de 2018

Comentada:

el 8 de Sept. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by