Problem 2091. return row and column indices given 2 values which define a range
Solution Stats
Problem Comments
-
5 Comments
last test suit gives an error:"'Error using assert The condition input argument must be a scalar logical. Error in TestPoint11 (line 5) assert(and(R9==1,C9==1))"
also even when I'm using find just to check the results of test suits some of them fail. please fix it ... Thank you !
HINT!
although the problem does not STATE it you are required to post the solution as a column vector (rowidx colidx that is) . In the case that donnot use magic matrix the solution will pass as row vector too but for the ones that the matrix is magic it wont.
As @Shahriar mentioned, the test suits still have problems. Kindly fix it.
#1,#4: assumes x2 is the lower limit and x3 is the upper limit while all other take x2 as upper limit
@Dyuman Joshi: the problem description specifically states that the inputs can be passed in in random order. What you indicate as an error is actually intended.
@goc3 I must have overlooked it while solving the problem.
Thanks for pointing it out.
Solution Comments
-
2 Comments
That second line. :D
What a hack.
-
1 Comment
My bad on the comment. But still test suits have problems:
#1: assumes x2 is the lower limit and x3 is the upper limit while all other take x2 as upper limit
#4 same issue
-
1 Comment
In my own solution I did not use ind2sub.
-
2 Comments
Nice solution, I overlooked the potential usage of ind2sub.
You should use 'varargin' here ;-)
take a look: http://www.mathworks.de/matlabcentral/cody/problems/2091-return-row-and-column-indices-given-2-values-which-define-a-range/solutions/382339
-
1 Comment
using varargin is also a good suggestion. Thanks.
Problem Recent Solvers63
Suggested Problems
-
253 Solvers
-
530 Solvers
-
172 Solvers
-
461 Solvers
-
Find nearest prime number less than input number
461 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!