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.

doubts regarding matlab programming

Status
Not open for further replies.

M.Shobana

Member level 1
Joined
Sep 13, 2011
Messages
35
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,505
hai

I want to assign values in the circular manner in matlab
for example:
for x = 1:N
data(x) = 1;
data(x+1) = 2;
data(x+2) = 3;
end

but this is not working when the value of x is equal to 2.
I want to store value in the 'data' like data(1) = 1,data(2) = 2,data(3) = 3,data(4) = 1 ,data(5) = 2 .........data(N)
If anybody knows please help me
 

Code:
for x = 1:N
   
         if rem(x,3)== 0
data(x) = 3;
data(x-1) = 2;
data(x-2) = 1;
         end
end

only works for N=multiples of 3.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top