07-13-2020 11:17 PM
Hello everyone.
I want to calculate the signals area. And from what I learn, to calculate the signal area we can total all of the signal value. I use sum array to get the total of signal value.
But when I use sum array, all of the signals will be totaled together at one time.
How to make the program to calculate the area 1 first and after that, it will calculate the area 2. So area 1 and area 2 have their own area?
Here I attached the VI I made
Thank You
Regards
Rani
07-14-2020 12:25 AM - edited 07-14-2020 12:32 AM
Hi Rani,
@Rani_jcha wrote:
How to make the program to calculate the area 1 first and after that, it will calculate the area 2. So area 1 and area 2 have their own area?
Determine the parts of your signal you want to analyze, then apply ArraySubset on your data.
Calculate the sum of each array subset…
In your VI you should learn to simplify: the loop handling those LED indicators can be simplified to:
The FOR loop runs so fast it only makes sense to use the last element of those boolean arrays. No need to use case structures (aka Rube-Goldberg!) when there are basic boolean operations like NOT. Btw. "Up" and "Left" react on the very same conditions?
07-14-2020 01:44 AM
You can just mask the undesired areas, the integrate the negative and positive parts differently. Here's one possibility.
As has been mentioned, your code was a bit confusing and especially the FOR loop made no sense and looked wrong. I think you should test that separately.
07-14-2020 08:38 AM - edited 07-14-2020 08:40 AM
Hallo Altenbach
Thank you for replying to my question.
I have tried your code but i think it's not going well in my computer.
it's become like this in my pc. And if when I tried more than two signals, the signals after the first one can't be detected.
How to make the program that can adding one by one like it's real-time? so when the signal values are detected bigger than 0.5 the value will start to calculate. and when it is lower than 0.5 it stop and start to count again when meet value that lower than -0.5.
I tried using for loop for and made time delay, so the data will work one by one. But I think Array Sum doesnt work in Array Sum.
I'll fix the led programs
Regards
Rani
07-14-2020 08:57 AM
Hallo Gerd, Thank you for replying my question
I used for loop so the indicator can be a boolean. If I am not using for loop, the indicator will be an array.
Btw. "Up" and "Left" react on the very same conditions?
No, I put the wrong wire.
Up = negative negative
left = negative positive
Regards
Rani
07-14-2020 09:18 AM - edited 07-14-2020 07:32 PM
@Rani_jcha wrote:
Hallo Altenbach
it's become like this in my pc.
That's because your PC localization setting defines comma as decimal point.
Simple fix: Just add a format of "%.;%.3f" to read from spreadsheet file. (the %.; make sure that a period is recognized).
07-14-2020 09:24 AM
@Rani_jcha wrote:
No, I put the wrong wire.
Up = negative negative
left = negative positive
You are missing the condition when any or both of the inputs is zero. I am sure there is an easier way....
07-15-2020 02:08 AM
I recognized how to make the indicator work.
But can I asked about the signal area program?
the program you attached did work, Thank you.
But actually I want to recognize the signal area one by one. So one signal has its own area.
The program will be started when the signal is >0.5 and stop when the value is not fulfilled. And started to count the new value area when the signal is <-0.5 or vice versa.
I tried using for loop conditional to stop the program and start again, but I think it does not work well
Here I attached the vi.
Rani
08-18-2020 11:36 PM
Check this VI.
08-19-2020 02:36 AM - edited 08-19-2020 02:37 AM
Hi PBP,
while it's fine to provide another example for this already solved thread, but please keep in mind the problems when comparing float values for equality:
This part of your VI most often will not give the expected result!