Results 1 to 2 of 2

Thread: Matlab - Need help on strings

  1. #1
    Junior Member
    Feb 2009

    Matlab - Need help on strings

    clc %clear command
    clear %clear workspace

    Roster = []

    %Infinite while-end loop (1 == True)
    while (1)
    %Create a menu of options. (Steps 1-2) (Given in the homework)
    fprintf('\n1 - Enter Names In Roster \n');
    fprintf('2 - Quit \n');

    %Input a choice number (1-4 for menu)
    choice = input('\n Please enter your choice:');

    switch choice%Switches to choice case
    %The user selects an option and the system displays the corresponding result/function (Given to us in the lab)
    case 1
    Roster = input('Please enter a [first_name, blank, last_name] using the char function:');

    %For case 2, it breaks and displays "Quitting"
    case 2
    fprintf('Quitting! \n'); %Print message "Quitting!"

    %If the user enters a value outside the [1 2] range, the system displays the error message "Invalid Entry"
    %Could also use disp('Invalid Entry')
    %If input any number that isn't (1 to 2) Then display (Invalid
    %Option) and go back to the main menu
    disp('invalid option')

    + I need help if I am doing this right, I think I have the menu down, and you have to enter the names as a string. e.g: char('bob dylan',walt disney')
    But now i have a problem, how do I re arrange the names that so it will display lastname firstname. Originally the user types in firstname lastname. (use slicing and concatenation is a hint)

    next I need to know how to make the uppercase of the initials....

    After that I should be set in trying to do the homework. It's due on March 29, but I need to understand it since i have an exam on thursday April 1
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Nov 2005
    If you can provide by PM any evidence that this is not a part of your assessment and if I am convinced I will reopen the thread.

    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. How many eight-bit strings contain exactly three 0's
    Posted in the Discrete Math Forum
    Replies: 7
    Last Post: Dec 4th 2010, 09:06 AM
  2. Counting Strings
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: Nov 12th 2009, 01:29 AM
  3. Bit strings
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: May 10th 2009, 12:07 PM
  4. strings
    Posted in the Statistics Forum
    Replies: 10
    Last Post: Jan 17th 2009, 01:35 PM
  5. Matlab: Loading from strings
    Posted in the Math Software Forum
    Replies: 1
    Last Post: Apr 10th 2008, 12:13 PM

Search Tags

/mathhelpforum @mathhelpforum