I want to create a function z=f(a,b)..how can I create like this using the below code?
Mostrar comentarios más antiguos
if true
a=Ns;
b=8;
if ~mod(a,b)
z=0
else
z=b-mod(a,b);
end
end
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 20 de En. de 2018
The calculation simplifies.
f = @(a,b) mod(-a, b);
This applies even for negative a
1 comentario
PLACEIUS NISHIGA G
el 20 de En. de 2018
Categorías
Más información sobre Functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!