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

1 Ansicht (letzte 30 Tage)
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?

Antworten (1)

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

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by