Can anyone please help me to understand the problem here? I keep getting the error "Index exceeds matrix dimensions".
Show older comments
for i = 1:length(circles)
if (circles(i,1) ~= 0 & peaks(i,2) ~= 0)
xp = peaks(3,i).*cos(ang);
yp = peaks(3,i).*sin(ang);
end
end
Accepted Answer
More Answers (2)
Matt J
on 26 Dec 2012
You've done something similar to the following,
>> x=1:5; a=x(6)
Andrei Bobrov
on 26 Dec 2012
Edited: Andrei Bobrov
on 26 Dec 2012
if size(circles,1) == size(peaks,1)
dc = cellfun(@(f)f(ang).*peaks(3,circles(:,1) & peaks(:,2)),{@cos,@sin},'un',0);
[xp,yp] = dc{:};
end
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!