I have got the following code:
—
K=zeros(100,100);theta=0:.1:7;radius=10;[X,Y] = pol2cart(theta,radius);A=[round(X)+10];B=[round(Y)+10];linearIndex = sub2ind(size(K),A,B);K(linearIndex) = 30;
—
When I run the script I get the following error: Error using sub2ind (line 43) Out of range subscript.
How do I solve this problem? Thanx for help 🙂
My end goal is to write code, that creates a circle in a matrix.
Best Answer