Effacer les filtres
Effacer les filtres

How to take values from a data corresponding to specific value

1 vue (au cours des 30 derniers jours)
Murad Nuri
Murad Nuri le 8 Juin 2020
Commenté : Murad Nuri le 8 Juin 2020
I have a 400:2 txt. data. A value corresponding to 0.3 is 1.5373. How can I call the value of 1.5373 from the txt. data by putting 0.3 in the command board?
Please,anybody help me.

Réponse acceptée

KSSV
KSSV le 8 Juin 2020
Read about interp1. You can use interpolation and get it.
Also you can use logical indexing. But I prefer interp1. Let A be your 400*2 data.
x = A(:,1) ; y = A(:,2) ;
% Using interp1
xi = 0.3 ;
yi = intepr1(x,y,xi)
% using indices
xi = 0.3 ;
idx = find(abs(x-xi)<10^-3);
yi = x(idx) ;

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by