02-10-2012 11:49 AM
Buongiorno,
sono nuovo del forum e relativamente nuovo del software Labview, premetto che ho effettuato diverse ricerche di soluzioni al problema che sto per porre ma non ho trovato riscontri.
Ho 4 array composti da numeri, tutti i vettori sono delle stesse dimensioni, uno di essi é la variabile indipendente X e gli altri Y1,Y2 e Y3.
L'array X é costituito da sequenze di valori nulli e sequenze di valori non nulli, ciò che devo fare é trovare le porzioni di array in cui X è non nullo ed estrarre tali porzioni in un sub-array di dimensioni minori che contenga appunto solo i valori non nulli di X.
In parallelo devo estrarre da Y1, Y2 e Y3 i dati corrispondenti agli indici di X estratti per ottenere i relativi sub-arrai Y1,Y2 e Y3.
Non ho difficoltà a realizzare una operazione simile in Matlab, mentre non riesco ad implementare in Labview l'analogo codice, qualcuno pò darmi qualche indicazione per risolvere il problema?
Grazie
Solved! Go to Solution.
02-10-2012 12:07 PM
Hi,
I'm a new user of this forum and quite new user of Labview software; I've been searching for answers at the question i'm going to explain over internet but I can't find a proper one.
I've got 4 arrays of the same length, one is the independent variable X and the others the X-dependent variables Y1, Y2, Y3.
Array X is composed by sequences of zeros and sequences of non zero values: I need to extract into a smaller size subarray the only non zero portions of x. At the same time I need to extract the values corresponding to the indices of the extracted values x frome arrays Y1,Y2,Y3 into 3 sub-arrays.
I can easily write a Matlab code to do that but I can't obtain the same function in Labview, is anybody can help me?
Thanks,
regards.
02-13-2012 03:19 AM - edited 02-13-2012 03:21 AM
Hi Hellhammer,
so you want to remove all 0s from the X array and the corresponding Y arrays?
[edit] the tabs didn't turn out well but these tables are simply 4 columns of values for x, y1, y2, y3...
This is what I understand:
XY1Y2Y3
2567
0291
0452
3166
0560
4946
7132
6454
0112
Should look like this:
XY1Y2Y3
2567
3166
4946
7132
6454
Is it correct?
Regards,
joseph
02-13-2012 03:41 AM
Hi,
Thank you for the interest in my question.
Yes, it's exactly what I need to do!
I can either delete the x zero parts and relative Y or store the "interesting" parts in new arrays.
Thanks
Regards
02-13-2012 08:31 AM
Hi,
so here's a pretty basic example of how it could be done.
If however you have very large arrays and performance is a problem, then you'll probably want to calculate first the final size of the sub-arrays, create them with full capacity and then fill up by running through the initial arrays selectively. If performance is not an issue though, my example should work well enough.
I haven't done any extensive testing so be careful and check it with a few runs first to make sure it works as expected.
regards,
Joseph
02-13-2012 09:54 AM
Thank you very much, it worked perfectly!
Regards.