Filtering the values of current and voltages based on a criteria
5 views (last 30 days)
Show older comments
I have a list of 1000000 sets of data in a .mat file. it has 5 columns, say A,B,C, Current and voltage. for many sets of data we would be having same current and voltages values. I need to read the file and then I need to filter out and get the values of current and voltage as output based on some condition. How do i do it ? I'm new to matlab. kindly help
The data looks something like this
A B C current voltage
.1 0.33 .99 1 1
0.2 0.34 .100 1 2
0.3 0.35 .101 1 3
0.4 0.36 .102 1 1
0.5 0.37 .103 2 3
0.6 0.38 .104 2 6
0.7 0.39 .105 2 8
0.8 0.40 .106 3 3
0.9 0.41 .107 3.5 3
0.10 0.42 .108 3 3.5
0.11 0.43 .109 3 0
0.12 0.44 .110 3 3.5
0.13 0.45 .111 3.5 0
0.14 0.46 .112 3.5 6
0.15 0.47 .113 3.5 7
How do i print the values of current and voltage by reading each data based on some condition ( condition is not related to current or voltage ) .The condition is with respect to time, and not A,B, C
PS: reading the file is done, I'm getting the proper output. only filtering part is left
0 Comments
Answers (1)
Ameer Hamza
on 12 Mar 2020
Suppose you have two linear arrays named current and voltage, you can filter them based on a condition as follow.
mask = current > voltage;
current = current(mask);
voltage = voltage(mask);
It filters all values where current is greater than voltage.
14 Comments
Ameer Hamza
on 3 Apr 2020
load('filename.mat'); % write your filename
mask = time == 1;
filtered_current = current(mask);
filtered_voltage = voltage(mask);
See Also
Categories
Find more on Wind Power in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!