Results 1 to 2 of 2

Math Help - Matlab - Need help on strings

  1. #1
    Junior Member
    Joined
    Feb 2009
    Posts
    29

    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:');
    Roster

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

    %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')
    otherwise
    %If input any number that isn't (1 to 2) Then display (Invalid
    %Option) and go back to the main menu
    disp('invalid option')
    end
    end


    + 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
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    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.

    CB
    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: December 4th 2010, 08:06 AM
  2. Counting Strings
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: November 12th 2009, 12:29 AM
  3. Bit strings
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: May 10th 2009, 11:07 AM
  4. strings
    Posted in the Statistics Forum
    Replies: 10
    Last Post: January 17th 2009, 12:35 PM
  5. Matlab: Loading from strings
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 10th 2008, 11:13 AM

Search Tags


/mathhelpforum @mathhelpforum