Checking for decimals values in input
Ältere Kommentare anzeigen
I am trying to write a function that wil display an error message if the input is not a whole number IE: the user the value 1.5 for the value of r in the code below.
Thank you.
function [R]=Newreshape(M,r,c)
Antworten (3)
Stephen23
am 21 Feb. 2019
0 Stimmen
assert(fix(r)==r,'Input r must be a whole number')
Adam
am 21 Feb. 2019
validateattributes( r, { 'numeric' }, { 'scalar', 'integer' } )
Patirick Legare
am 1 Mär. 2019
0 Stimmen
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!