Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

doubt in matlab realting to for loop

Status
Not open for further replies.

sujai_249

Newbie level 3
Joined
Aug 23, 2010
Messages
3
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
hyd
Activity points
1,299
I want to write a code to reverse a number.this is the code i've written..

clc
clear all
n=input('enter any number');
for r=0:n
x(r)=(r*10)+ rem(n,10);
x(n)=n/10;
end
r

the error i am getting is

??? for
|
Error: Incomplete or misformed expression or statement.


In C language the for loop i use is:
for(r=0;n!=0;n/=10)

please help me out

---------- Post added at 05:18 ---------- Previous post was at 05:14 ----------

Also can i give a command like this in matlab:

for r=0:(n>0)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top