thank you! Found the solution! Thank you!

3 Kommentare

madhan ravi
madhan ravi am 7 Apr. 2019
findpeaks() ?
madhan ravi
madhan ravi am 7 Apr. 2019
So as I understand you want to find the max value for each 16 rows ???
madhan ravi
madhan ravi am 7 Apr. 2019
NO NO NO!!!!,Why did you delete all the contents of the question and the comments?, it's a terrible thing to do . Others may also benefit from the question.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

madhan ravi
madhan ravi am 7 Apr. 2019
Bearbeitet: madhan ravi am 7 Apr. 2019

2 Stimmen

See if this does what you want , first we split into 16 separate rows each and then we conquer in the third dimension:
[m,n]=size(A); % where A is your matrix of size 256 X 40K
parts = 16;
AA = permute(reshape(A.',n,m/parts,[]),[2,1,3]);
Max = max(AA,[],[1,2]); % max(max(AA)) for versions <= 2016b
[r,~]=find(AA == Max) % r represents rows

6 Kommentare

Anh Dao
Anh Dao am 7 Apr. 2019
Bearbeitet: Anh Dao am 7 Apr. 2019
r,c seems to be wrong, I tried, and there seems to be problem with the split , the row appeared to be all 1, can you please check?
madhan ravi
madhan ravi am 7 Apr. 2019
Bearbeitet: madhan ravi am 7 Apr. 2019
Could you illustrate with a short example? c gives you the linear index unlike r, what do you mean the split is wrong?
>> A = rand(8,2)
[m,n]=size(A);
parts = 2;
AA = permute(reshape(A.',n,m/parts,[]),[2,1,3]);
Max = max(AA,[],[1,2]);
[r,~]=find(AA == Max)
A =
0.6944 0.9400
0.3253 0.6584
0.4368 0.9652
0.7557 0.0311
0.4930 0.1461
0.7457 0.5300
0.8067 0.8428
0.9376 0.0922
r =
3
4
>>
Anh Dao
Anh Dao am 7 Apr. 2019
I've got this error Product of known dimensions, 40000, not divisible into total number of elements, 15.
madhan ravi
madhan ravi am 7 Apr. 2019
Bearbeitet: madhan ravi am 7 Apr. 2019
256 is divisible by 16 where did you get 15 and why are you bothered with columns now?? We are focused on rows ?
[r,c,p]=ind2sub(size(AA),find(AA==Max)) % r represents rows , c represents columns & p represents pages
Post the code that your trying.
Thank you, so I have a matrix A equal 256x40000
it was a mistake that I put in last time that i put parts = 15, sorry about that, so r should be correct right, what's the difference in the code you posted?
[m,n]=size(A)
parts = 16;
AA = permute(reshape(DoM.',n,m/parts,[]),[2,1,3]);
Max = max(AA,[],[1,2]);
[r,~]=find(AA == Max)
replace
[r,~]=find(AA == Max)
with
[r,c,p]=ind2sub(size(AA),find(AA==Max)) % r represents rows , c represents columns & p represents pages

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by