Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone help me with this syntax error?

Status
Not open for further replies.

lovepiano25

Bioengineer
Feb 24, 2012
1
0
0
US
xi = zeros(1024*655,2)
counter= 1
for y = 1:1:655
for x = 1:1:1024
xi[counter,1] = x
xi[counter,2] = y
counter= counter+1
end
end

There two syntax are indicated as an error in matlab : xi[counter,1] = x; xi[counter,2] = y
Can someone please help me correct this syntax? I am trying to recalculate at different points.
Thank you
 
Replies continue below

Recommended for you

Try using round brackets instead of square brackets:
Code:
xi = zeros(1024*655,2);
counter= 1
for y = 1:1:655
    for x = 1:1:1024
        xi(counter,1) = x;
        xi(counter,2) = y;
        counter= counter+1;
    end
end


=====================================
(2B)+(2B)' ?
 
Square brackets [] indicates a C (or C++) programmer. Beware also that Matlab arrays aren't zero-based. A very common issue for code conversion.

- Steve
 
Status
Not open for further replies.
Back
Top