how do you check that a value input into your code is exactly 7 digits long before proceeding?

1 view (last 30 days)
in my code we enter a value that is seven digits long our school id's for example
idNumber = ('1234567');
how can i verify that this number is seven digits long using a loop?

Answers (1)

Stephen23
Stephen23 on 15 Feb 2019
idNumber = '1234567';
assert(numel(idNumber)==7,'Wrong length ID number')

Categories

Find more on Creating and Concatenating Matrices 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!