d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Pseudo To Matlab Code > 50 Fg Ft
Add Reply New Topic New Poll
Member
Posts: 33,701
Joined: Jul 17 2006
Gold: 1,990.00
Aug 7 2012 12:43pm
hey guys,
i need some help making a matlab function that asks the user to input an integer value.

do
while (M is not an integer > 0)
fprintf('please enter the order of the filter: ')
{user input for M}
end


i dont know how to make a do while loop in matlab, the "isinteger" function doesnt seem to work for me and i dont know how to store a value like c's scanf function. if someone can turn the above code into a working matlab code
Member
Posts: 9,099
Joined: Nov 23 2002
Gold: 2,911.26
Aug 7 2012 06:28pm
matlab doesn't do that.... you don't "input" in matlab... you can just define "M"

so that all would be reduced down to

M=1; %(or whatever you want defined in the m-file)


or if you want you can make your m-file a function and call it with that M

call it with
yourfunction(1)


function out=yourfunction(M)

M=num2str(M)
disp(['your number is ',M])

end
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll