Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
assign menu to with options

Subject: assign menu to with options

From: John Wong

Date: 25 Sep, 2009 04:40:19

Message: 1 of 1

clear all;
clc;

wbVolume = 0;
wbBill = 0;
flatRate = 15;
char('opt1','opt2','opt3','opt4','opt5');

wbVolume = input('Enter a number: ')

switch wbBill
    case opt1
        wbVolume = 0;
        wbBill = 0;
    case opt2
        (wbVolume > 0) && (wbVolume - 1000 < 1000);
        wbBill = flatRate;
    case opt3
        wbVolume >= 1000 && (wbVolume - 1000 < 2000);
        wbBill = flateRate + (wbVolume * 0.0175);
    case opt4
        wbVolume >= 2000 && (wbVolume - 1000 < 3000);
        wbBill = flateRate + (wbVolume * 0.02);
    case opt5
        wbVolume > 3000;
        wbBill = 70;
    otherwise
        disp('Invalid input')
end
pF = plot(x,y)
k=menu(wbVolume,wbBill,pF);



I cannot use the GUI editor to accomplish what I want. Instead, I need to create this by hand, in a simple code.

My idea is to have a matlab function "menu" called and once I input a number (wbVolume), the menu will appear like this
let say wbVolume = 100
--------------------
| 100
| wbBill
| pF
|___________

wbBill will be shown as a number (because as you can see, the algorithm goes down with different calculation).
pF is simply a button. Users may press on it and will generate a graph (the piecewise function I will be setting up base on each case).
Is it possible to do it this way via the menu?

At least I want to try it with the first tow. The pF can be done in a straightforward way like asking whether the users want to print it or not.

I will appericate any kind of help here.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us