Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-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
Joined
Feb 24, 2012
Messages
1
Location
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
 
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.

Part and Inventory Search

Sponsor

Back
Top