How to gather data from a table with variables?
Show older comments
While coding a calculator app, i stumbled with a problem. One of the variables (let's call it A) is a result from an equation, and after that it is checked if the variable is higher than another variable (let's call it B). If A is lower than B, then A can be used for another equation, but if A is higher than B, then i have to check for a table, with three more variables (let's call it X, Y and Z), and the result on the table must be used in the same said equation. The variables X, Y and Z are gathered from equations, edit fields, or button group, so there's the big problem. In order to know wich number of the table i will use for the next equation, the table itself has to check for different variables. I'm currently using only 2 callbacks in the same function, here is an example of what my problem is.
Example:
X will be written at an edit field.
Y is a result of an equation that uses another equations results, but to simplify the exaxple i just used a simple one.
Z is a gathered from a Button Group, it is used for giving C a value, and also as a parameter on the table, so i need the table to aknowledge what button was pushed at the group (Z1 or Z2).

So as i said, A has to be lower than B, or else A will be selected in the table, following the right parameters.
% Callback function: CalculateButton, ZButtonGroup
function CalculateButtonPushed(app, event)
% Z button group
if app.Z1Button.Value
C=1;
elseif app.Z2Button.Value
C=2;
end
B=C*10;
d=app.dEditField.Value;
E=app.EEditField.Value;
X=app.EEditField.Value;
Y=d*X;
A=d*E;
if A<=B
R=A*100;
elseif A>B
R=app.UITable(?)*100
end
note: i don't know how to make a code that gather all information i gave, and auto select the right number from the table.
note2: i will probably have to input that table data into codes aswell, so if that's the case, i accept some enlightment on how to set the table.
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!