Rank: 3573 based on 31 downloads (last 30 days) and 2 files submitted
photo

Naresh Vankayalapati

E-mail
Company/University
University of Rhode Island

Personal Profile:

 

Watch this Author's files

 

Files Posted by Naresh Vankayalapati View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
03 Jul 2012 Laplacian Noise RANDL Laplacian distributed pseudorandom numbers. Author: Naresh Vankayalapati laplician random numb..., laplician noise 19 0
03 Jul 2012 Maximum value in multidimensional matrix MDMAX Largest component in a multidimensional matrix. Author: Naresh Vankayalapati multidimensional maxi..., multidimensional maxi... 12 3
  • 5.0
5.0 | 1 rating
Comments and Ratings by Naresh Vankayalapati
Updated File Comments Rating
09 Jul 2012 Maximum value in multidimensional matrix MDMAX Largest component in a multidimensional matrix. Author: Naresh Vankayalapati

@Jan Simon - Please try:
rand('state',0);
x = rand(3,3,3);
[value, pos] = max(x(:));
index = ind2sub(pos, size(x));

You will get
index =
3 3 3

Which is incorrect. Infact, your usage of ind2sub is incorrect. Please look at the help. If you use it the correct way which is
>> ind2sub(size(x),pos)
then the problem is you need to use it as
>> [r,c,h] = ind2sub(size(x),pos)
So, you need to know how many output arguments to use based on the dimensions of x. Notice that the myind2sub subfunction in mDmax takes care of this and so now you can use any dimensional matrix as input for mDmax.

Comments and Ratings on Naresh Vankayalapati's Files View all
Updated File Comment by Comments Rating
28 Nov 2012 Maximum value in multidimensional matrix MDMAX Largest component in a multidimensional matrix. Author: Naresh Vankayalapati Kieran

10 Jul 2012 Maximum value in multidimensional matrix MDMAX Largest component in a multidimensional matrix. Author: Naresh Vankayalapati Jan Simon

@Naresh: Thanks for your answer. You are right, I've confused the order of arguments for IND2SUB.
Do I understand correctly, that the benefit of your function is a smarter IND2SUB function, which replies a vector instead of a list of indicies? If so, it might be more useful for others, if you post this improved IND2SUB explicitly, while the MAX(X(:)) part is trivial and could be omitted. There is a need for a modified IND2SUB, see e.g. http://www.mathworks.com/matlabcentral/newsreader/view_thread/236782 and http://www.mathworks.com/matlabcentral/answers/23599 .

09 Jul 2012 Maximum value in multidimensional matrix MDMAX Largest component in a multidimensional matrix. Author: Naresh Vankayalapati Naresh Vankayalapati

@Jan Simon - Please try:
rand('state',0);
x = rand(3,3,3);
[value, pos] = max(x(:));
index = ind2sub(pos, size(x));

You will get
index =
3 3 3

Which is incorrect. Infact, your usage of ind2sub is incorrect. Please look at the help. If you use it the correct way which is
>> ind2sub(size(x),pos)
then the problem is you need to use it as
>> [r,c,h] = ind2sub(size(x),pos)
So, you need to know how many output arguments to use based on the dimensions of x. Notice that the myind2sub subfunction in mDmax takes care of this and so now you can use any dimensional matrix as input for mDmax.

04 Jul 2012 Maximum value in multidimensional matrix MDMAX Largest component in a multidimensional matrix. Author: Naresh Vankayalapati Jan Simon

What is the benefit compared to:
[value, pos] = max(x(:)); index = ind2sub(pos, size(x))
?

Contact us