Sir I was given the following question Write a MATLAB function called looptest (N) that loops through the values I through N and for each number n it should divisible by 2', 'n is divisible by 3, 'n is divisible by 2 AND 3 'n is NOT divisible by 2 or 3 In answer i have written function loopTest(N) for i=1:10 r=rem(i,2); s=rem(i,3); if r==0 && s==0 fprintf("%d is divisible by 2 AND 3 ",i); elseif r~=0 && s~=0 fprintf("%d is not divisible by 2 or 3 ",i); elseif r~=0 && s==0 fprintf("%d is divisible by 3 ",i); elseif s~=0 && r==0 fprintf("%d is divisible by 2 ",i); end end N is given by me in input.is this wrong?
Great information, thank you very much.
Sir I was given the following question
Write a MATLAB function called looptest (N) that loops through the values I through N and for each number n it should divisible by 2', 'n is divisible by 3, 'n is divisible by 2 AND 3 'n is NOT divisible by 2 or 3
In answer i have written
function loopTest(N)
for i=1:10
r=rem(i,2);
s=rem(i,3);
if r==0 && s==0
fprintf("%d is divisible by 2 AND 3
",i);
elseif r~=0 && s~=0
fprintf("%d is not divisible by 2 or 3
",i);
elseif r~=0 && s==0
fprintf("%d is divisible by 3
",i);
elseif s~=0 && r==0
fprintf("%d is divisible by 2
",i);
end
end
N is given by me in input.is this wrong?
I will check it and let you know
Thanks a lot 🙏 ❤❤❤❤🎉🎉🎉🎉
Can you convert these simulink model to matlab code not C or C++
when changing nonreusable function to reusable function in code interface ..giving error in python please help
you cant plainly copy into a controller - how will you do it say for arduino?
Arduino cannot store the Simulink code, but it executes directly while connected to MATLAB.
Cutral v? Or B
B