Extracting information from input, help needed

I am a real newbie to Matlab and am currently only using it for work within university. With my current project I have hit somewhat of a snag.

I wish to extract a number from the user input that I require to start the program.

Basically it runs like this:
A = 7 digit number gained from input
B = first 6 digits
C = last digit

I have no clue how it would be possible to grab B or C from A. Anybody able to help?

Comments

  • You can code in this way:

    A=input('Input 7 digits: ');
    A=num2str(A);
    B=A(1:6);
    C=A(7);

    Then, it depends on what you have to use B and C.
  • Thanks a heap mate, been frustrating. Works exactly how I require it to.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories