Prev: Deploytool help please: Can't get standalone Windows GUI without DOS window
Next: how to use textscan in a for loop with header lines increasing
From: Walter Roberson on 1 Mar 2010 14:24 Nicola wrote: > For instance, if I have got a vector describing a rectangle xy=[165 88; > 401 88; 401 278; 165 278 on an image. > > Can i obtain the following vector [165 88;166 88; 167 88;...;400 88; 401 > 88; 401 89;...;401 277; 401 278;400 278;...;164 278;165 278;165 > 277;...;165 87 using a Matlab's inbuilt function or do I need to write > it using FOR LOOPS? The algorithm must work for a generic vector with > n-points and xy coordinates. Thanks! "a generic vector" -- does that include vectors that might be at angles other than horizontal and vertical? If you restrict to horizontal and vertical, sub2ind and arrayfun should help. Depending on exactly what you are trying to accomplish, roipoly() might be beneficial. |