01-29-2012 07:26 PM
I am trying to read from a text file. I got a simple question. I need to delete two rows from an array. I wish to use the Delete From Array function. But I read that I can wire only one index input. I have a total of 8 rows. I wish to delete the first two rows of the array.
As quoted from LabVIEW Help, "You can delete multiple consecutive subarrays at once by wiring length."
How do I exactly achieve this?
Thanks in advance.
Solved! Go to Solution.
01-29-2012 07:55 PM - edited 01-29-2012 08:02 PM
@johnny az wrote:
I wish to use the Delete From Array function. But I read that I can wire only one index input.
The context help says
"This function reduces the array in one dimension only, therefore, you can wire only one index input. For example, to delete a row in a 2D array, wire only the row index. To delete a column, wire only the column index. You can delete multiple consecutive subarrays at once by wiring length."
That means if you have a multi-dimension array, you can only wire one of the index inputs such as row or column. The length input doesn't count because it is not an INDEX input.
By wiring in a constant to the length input of the function.
01-29-2012 09:25 PM - edited 01-29-2012 09:27 PM
Thanks for the response. I thought that would have solved my problem. But I realized that wasn't gonna affect anything. The problem is caused by another thing. I have this text files that I need to display on a waveform. But SOME of the text files are disrupted such that the the columns has words instead of data.
As shown in the screenshots, the 'Info; Time' column is affecting my waveforms.
Problem is: I checked with the other affected text files and found out that its not in a fixed column number. It appears irregularly. That makes my task harder because, if it was in a fixed column number, I could've just delete array the column number.
I really hope you get what I'm trying to voice out. Is there possibly anything I can do about this? Sort of disregard any columns with words or something? Really can't think of anything lol.
Best Regards.
01-29-2012 09:26 PM
Here's the vi and the text file.
01-29-2012 10:23 PM - edited 01-29-2012 10:29 PM
johnny,
You can read the text file, remove the row having the label you are looking for(Delete array), then use the search array function to get the index to extract the values of that column using the remaining set of array. I don't have lv2011 so wasnt able to see your vi.
From what I see of your text file, i think you could bypass the text from the file and build that into the array, see Scan from String function.
01-29-2012 10:23 PM
Hi Johnny,
For time being I am giving you a clue. You can use the NaN value in Double input to the function Fractional String to Number as shown in the figure below.
If you do this you will get the NaN values in all the places where you are getting the string so you can delete those values from the array before passing it for building the waveform.
01-29-2012 10:24 PM
I think where you said the text is not in a fixed column number, you actually meant in a fixed row number.
You need to iterate through the array an look for rows that are text, and not build that into your array.
See attached.
Notes:
You don't need to write a constant to every input of the Index array function, each input is consecutive to the one before it by default.
You don't want to set your graph X axis multiplier to 300 when you are also establishing your dT for the waveform to be 300.
01-30-2012 12:03 AM
Hi Fragger Fox,
Would love to know how you really meant by that. I've saved in 8.5
01-30-2012 12:07 AM
Hi Anand,
What dyou mean by "so you can delete those values from the array before passing it for building the waveform." I've done as you said, by using nan as the double input for Fract/Exp String to Number. From the Fract/Exp String to Number function, I wired it to Index Array and immediately build the waveform. Where do I exactly 'delete those values'? Besides that, I tried not doing anything apart from using the nan double input, and my waveform displayed no plots. 😞
01-30-2012 12:17 AM
Hi Ravens Fan,
Yes pardon me for that row/column mistake. Was getting mixed up! I'm kinda new to LabVIEW and gotta confess I'm not a big fan of loops and structures. But I know I cannot avoid that in the long run. Nevertheless I tried understanding what your vi though.
I don't really get what you mean by "when you are also establishing your dT for the waveform to be 300". I input my X axis multiplier to 300 and maximum to 86400 because I need to display it on a 24 hr scale. And to explain my y axis maximum 60, is because I'm actually focusing on analysing the Poly_M_Temp and TF_M_Temp plots, which are the last two columns.
I've attached an excel file, of what I'm trying to imply.
Anyway, thanks for the first tip! "You don't need to write a constant to every input of the Index array function, each input is consecutive to the one before it by default."