How do I get MATLAB to extract a specific value in an array?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Brad
il 19 Feb 2014
Modificato: Azzi Abdelmalek
il 19 Feb 2014
I’ve got a 6 x 2 double that looks like this;
AA =
1.5 1269.52132592592
2.5 1331.48519957181
3.5 350.503689964563
4.5 105.680838840683
5.5 33.4192155773747
6.5 32.0466481498415
I’m looking to identify the indices in column 1 when the data in column 2 is less than 105, and then extract the first actual value from column 1 that meets this criteria.
>> BB = (AA(:,2) < 105) results in:
BB =
0
0
0
0
1
1
But how do I use MATLAB to extract and save the actual value of 5.5?
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 19 Feb 2014
Modificato: Azzi Abdelmalek
il 19 Feb 2014
idx= AA(:,2)<105
out=AA(idx,1)
0 Commenti
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!