04-24-2020 11:56 PM
Hello everyone
I want to make a program about the directions of eye movements. The input is from Excel Signal Data.
I input my Excel data using Read From Spreadsheet File and use the String One.
I have two signals: Ch1 and Ch2.
To make the program I have to read each column, so I have to separate the column. I tried to use index array but it didn't work, and I tried to use Spreadsheet string to array and it didn't work either because of the type of data is 2d array. What should I do to solve this?
Here I attached my vi and my excel data
Solved! Go to Solution.
04-25-2020 12:26 AM - edited 04-25-2020 12:27 AM
Your column delimiter is a semicolon, not a double-space.
To get the first column, you need to wire the column index to the lower of the two index terminals.
Now you also need to remove the column header. See how far you get.
(Your while loop spins millions of times per second, reading the same file over and over. Seems pointless. Right?)
04-25-2020 10:49 PM
Thank you for the replied, It did work. How do I kwon my while loop is spins millions of times per second?
and why I have to remove the header?
Regards
Jenni
04-26-2020 02:37 AM
Your while loop is spinning as fast as the computer allows, repeating the same operations over and over. Since the results never changes, that's just pumping a lot of hot air for nothing. It is sufficient to read the file once. You don't need the loop at all.
(If you want a toplevel polling loop, you would place a short wait in it (e.g. 50ms).Look in the timing palette. Alternatively, use an event structure that only repeats the code whenever the file name is changed)
You don't have to remove the headers, but if you want to process the numbers (e.g. for a graph or calculation), the headers need to be handled separately.
04-26-2020 08:40 AM
Thank you so much for your respond.
I understand, so I have to put delay to my labview program.
Can I ask you another question?
I want to process the data in array, is it better to change it to Number data type or I just let in in String data type? Because I want to make program with threshold detector and peak detector to process the signal.
If it's better to be changed, how can I change 1D array string to number? I've tried some example from forum but all of these got bad terminal things.
The program that I want to make maybe will be similar with this.
Regards
Jenni
04-26-2020 10:41 AM - edited 04-26-2020 10:48 AM
You cannot do math with strings, so you need numeric datatype for all that (and the header would turn onto a zero, which is misleading, so remove the headers)..
To convert a string to number, use "fract/exp string to number" (works with scalars and arrays with any number of dimensions equally well).
Whatever you have attached is not a snippet, just a flat image, so we can't really do anything with it. Can you attach the actual VI? Make sure your string contains typical default data. Also maybe include a picture explaining graphically what you want to count and what result you are expecting as result.
04-27-2020 12:05 AM
Thank You for your response.
I have tried using fract/exp string to number but the numbers after the commas didn't show up. The data become integer. I'll do the threshold program like this:
If Ch1 >-0,5 & Ch1 <0.5
true: Ch1 = 0
false: Ch1=Ch1
But when I tried using case structure, it's an error.
Here I attach the Vi and the data
Thank You
Regards
Jenni
04-27-2020 12:38 AM - edited 04-29-2020 01:48 PM
Works fine here. What is your system decimal point ("." or ","?). Why did you change these boolean constants to FALSE?
To zero all points that are out of range, use e.g. this:
04-27-2020 02:53 AM
Thank you for your response,
my system decimal point is (.)
-What you you change these boolean constants to FALSE?-
I'm sorry but what do you mean by this?
Sorry, but may I know the name of the icon you use? 😅
Thank You
Regards,
Jenni
04-27-2020 03:01 AM - edited 04-27-2020 03:05 AM
The boolean array will be TRUE for all array elements that are in the range defined by the limits, and zero otherwise. Converting that to numbers (TRUE:1, FALSE:0). Multiplying that with your data will zero all elements that are out of range and leave the others untouched.
@jennichrni wrote:-What you you change these boolean constants to FALSE?-
I'm sorry but what do you mean by this?
You have TRUE wired to the fract/exp string to number function. Change that to FALSE and see if it helps