find and reshape function ion matlab
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi together!
i used this functions to find the index of some element und reshape it in a special manner.
% ind= [find(fr==8.1); find(fr==8.2); find(fr==8.3); find(fr==8.4);...... ; find(fr==10)];
id=reshape(ind,length(index)/20,[]);20:is the number of fr to be found.
%fr is a big matrix.
could someone help to write this in compact way?
thank you
1 Commento
Jan
il 29 Gen 2013
Does the order of elements in index matter, or would ismember() do the identification sufficiently already? Are you sure, that length(index) is a multiple of 20 in every case?
Risposte (2)
Walter Roberson
il 29 Gen 2013
Your find() are mostly going to return no results.
Is there a connection between "ind" and "index" ?
Is there reason to expect that there will be no duplicate values?
Would histc() be suitable? You can get the indices of the elements from the second output of histc()
0 Commenti
Rica
il 29 Gen 2013
1 Commento
Walter Roberson
il 29 Gen 2013
Could there be more than one entry with value 8.1 ? Is it certain that the number of matches for any given "a" value will be the same?
The reshape can be simpified to
id = reshape(ind, [], 20);
You need to solve the problem that in your search range, only 8.5 and 9.0 and 9.5 and 10 are exactly representable in binary, and 8.1, 8.2, 8.3 and so on are not exactly representable. If the 8.1 value (for example) had been calculated even just slightly different then it would not match the 8.1 value that you search for. Please read http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!