Azzera filtri
Azzera filtri

my question is after ploting (x,y) , i want to count the number of signals that is above 0.5 at time for example : 1.05e-7, how to do that in matlab

1 visualizzazione (ultimi 30 giorni)
i want to count the values from data set (:,2:5) that is above 0.5 at specific time
data_1 = load('ay.csv')
x = data_1(:,1)
y = data_1(:,2:5)
plot(x,y)
count=0
n= 17059
m=4
for r=1:n
for c=1:m
if y(r,c)> 0.5 & (x == 1.05e-7)
count= count+1
end
end
end
count
  2 Commenti
Jan
Jan il 14 Set 2022
What is your question?
Does load('ay.csv') work? load works with MAT files and a specific set of text files only.
x is a vector. Then x==1.05e-7 is a vector also. The if condition must be a scalar. Therefore Matlab inserts an all() implicitly. But is this wanted?
Remember that comparisons of floating point numbers are fragile. 1.05e-7 and 1.0499999999e-7 might be displayed as the same value in the command wirndow, but they differ. Using a range is safer.
Hagar Hendy
Hagar Hendy il 14 Set 2022
yes loading works, my question is after ploting (x,y) , i want to count the number of signals that is above 0.5 at time for example : 1.05e-7.

Accedi per commentare.

Risposte (1)

Torsten
Torsten il 14 Set 2022
xx = 1.05e-7;
[~,i] = min(abs(x-xx));
count = nnz(y(i(1),:) > 0.5)

Categorie

Scopri di più su Large Files and Big Data 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!

Translated by