find a cell that corresponds to a range of values
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all,
If a I have a column of four cells where each cell contains a range of values, as shown below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1068295/image.png)
If I have a list that has five elements:
. I want to find the cell that corresponds to the range of values between each two consecutive elements in this list. For exmaple, what is the cell that is smaller than the first element and larger than the second? And then do the same for the second pair of elements.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1068300/image.png)
Thanks.
0 Commenti
Risposte (1)
dpb
il 17 Lug 2022
R=0:0.25:1;R=R.';
z=[0.98;0.74;0.34;0.21;0.10].';
>> [~,~,idx]=histcounts(z,R)
idx =
4
3
2
1
1
>>
In future, please attach data as text (use "code" button or Ctrl-E and it'll show up as code and copyable/executable. Nothing can do with images except look at them and then retype the data in manually.
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Import and Analysis 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!