I have two text files with numbers (signal1.txt and signal2.txt). I want to convert them to Integer array and have a process on them. When I converted them by Fract/Exp String To Number control, it shows just 0 (You can see in the attached file). How can I have the correct numbers?
Solved! Go to Solution.
Well your converting the numbers properyl. That isnt the problem.
You get the 0 everytime because you are doing the "process" on the 0 index of your array every iteration, which happens to be zero. I would consider doing away with the case structures and putting the process in a for loop for the smaller array size of iterations. Then i would index my array based on the iteration of the for loop.
[Edit] if youre attempting to only do the addition when elements are present in both arrays, labview will only do the process on the smallest array, it does not assume 0 when there is no element present.
Hope that helps.
Your two converted arrays look just fine to me.
I'm wondering what you are trying to do in the 2nd frame of your sequence structure. There you are just indexing out element 0 of both arrays repeatedly.
Looking at the code, I get the impression that you are new to LabVIEW.
I suggest that simplify your problem statement.
You might want to focus on how to properly read a file in the first place.
From what you are trying to do, LabVIEW developwers have already done it for you in examples. At least in piecewise chunks. You just need to dig in a bit.
Take a look at the examples provided in the detailed help.
You should find some clues on what you need to do.
I have no idea what you are trying to do in your process, but it looks overly complicated.
Once again the examples can help you here as well. Look up array manipulation.
I use the index zero to compare two elements in two arrays and based on some circumstances I remove the first element of each array (maybe one array is affected maybe both of them). Then I compare the element in index 0 again. It means I should compare the first element in each iteration. This matter is continuing till at least one array becomes empty. When I try it with an ordinary array it works but when I use a converted one it does not work and I guess removing items from a converted array is impossible. Please look at the new code and let me know your ideas. Thank you in advance.
Please look at the new code and let me know your ideas. Thank you in advance.
In each iteration, I remove an element from array1 and/or array2 so I should check their size.
So why are you iterating NxM times? You'll probably run out of elements way before that.
Do you have a description or link for the algorithm you are trying to implement?