Filtering the values ​​of current and voltages based on a criteria

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Filtering the values ​​of current and voltages based on a criteria

GK19
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 octave. kindly help
The data looks something like this
  A BC 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



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Filtering the values ​​of current and voltages based on a criteria

BGreen

On Thu, Mar 12, 2020 at 6:42 PM GK19 <[hidden email]> wrote:
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 octave. kindly help
The data looks something like this
  A BC 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



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


If the condition can be written as an equation, then you could use logical indexing. For example, 
m(m<10)=0
sets any entries of the matrix m to 0 if they are less than 10.

 m=magic(4)
m =

   16    2    3   13
    5   11   10    8
    9    7    6   12
    4   14   15    1

>> m(m<10)=0
m =

   16    0    0   13
    0   11   10    0
    0    0    0   12
    0   14   15    0

We wouldn't know how to help in more detail without knowing the condition, though.


Reply | Threaded
Open this post in threaded view
|

Re: Filtering the values ​​of current and voltages based on a criteria

GK19
Hi,

I forgot to add one more column that is the time, so there will be many time
slots for a set of data say one time slot will hold 1500 datas

so for a particular time slot, I need to print all the values of current and
voltage



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Filtering the values ​​of current and voltages based on a criteria

BGreen

On Thu, Mar 12, 2020 at 7:00 PM GK19 <[hidden email]> wrote:
Hi,

I forgot to add one more column that is the time, so there will be many time
slots for a set of data say one time slot will hold 1500 datas

so for a particular time slot, I need to print all the values of current and
voltage



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

Do you mean that, for one particular time value, there are many entries in the table?


Reply | Threaded
Open this post in threaded view
|

Re: Filtering the values ​​of current and voltages based on a criteria

Doug Stewart-4
In reply to this post by GK19


On Thu, Mar 12, 2020, 6:59 PM GK19, <[hidden email]> wrote:
Hi,

I forgot to add one more column that is the time, so there will be many time
slots for a set of data say one time slot will hold 1500 datas

so for a particular time slot, I need to print all the values of current and
voltage



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

Where is the time stored?


Reply | Threaded
Open this post in threaded view
|

Re: Filtering the values ​​of current and voltages based on a criteria

GK19
In reply to this post by BGreen

The condition is w.r.t time

  A B C current voltage time          
.1 0.33 .99 1 1  1ns
0.2 0.34 .100 1 2 1ns
0.3 0.35 .101 1 3 1ns
0.4 0.36 .102 1 1 2ns
0.5 0.37 .103 2 3 2ns
0.6 0.38 .104 2 6 1ns
0.7 0.39 .105 2 8 3ns
0.8 0.40 .106 3 3 3ns
0.9 0.41 .107 3.5 3 3ns

if i choose 1ns as the condition for time
The output should look like
Current =  1, 2
Voltage =  1,2,3,6.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Filtering the values ​​of current and voltages based on a criteria

GK19
In reply to this post by Doug Stewart-4

The condition is w.r.t time
  A B C current voltage time          
.1 0.33 .99 1 1  1ns
0.2 0.34 .100 1 2 1ns
0.3 0.35 .101 1 3 1ns
0.4 0.36 .102 1 1 2ns
0.5 0.37 .103 2 3 2ns
0.6 0.38 .104 2 6 1ns
0.7 0.39 .105 2 8 3ns
0.8 0.40 .106 3 3 3ns
0.9 0.41 .107 3.5 3 3ns

if i choose 1ns as the condition for time
The output should look like
Current =  1, 2
Voltage =  1,2,3,6.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Filtering the values ​​of current and voltages based on a criteria

Ian McCallion
In reply to this post by GK19
On Fri, 13 Mar 2020 at 08:24, GK19 <[hidden email]> wrote:

>
>
> The condition is w.r.t time
>
>   A B C current voltage time
> .1 0.33 .99 1 1  1ns
> 0.2 0.34 .100 1 2 1ns
> 0.3 0.35 .101 1 3 1ns
> 0.4 0.36 .102 1 1 2ns
> 0.5 0.37 .103 2 3 2ns
> 0.6 0.38 .104 2 6 1ns
> 0.7 0.39 .105 2 8 3ns
> 0.8 0.40 .106 3 3 3ns
> 0.9 0.41 .107 3.5 3 3ns
>
> if i choose 1ns as the condition for time
> The output should look like
> Current =  1, 2
> Voltage =  1,2,3,6.

if m is the data and contains 6 columns as you show above and as many
rows as there are data points then

wantedrows = find(m(:,6)==1);
current = unique(m(wantedrows,4));
voltage = unique(m(wantedrows,5));

I have not tested this but hopefully it is close enough to get you started.

Cheers... Ian