07-14-2024 06:52 AM
Hi,
Yes, you are right; it was my mistake to add a FOR loop. With the help of guidance and suggestions shared by all, now, my code is working fine. I attached the code.
Kind regards
Hasham
07-14-2024 07:44 AM
@Hasham622x wrote:
Hi,
Yes, you are right; it was my mistake to add a FOR loop. With the help of guidance and suggestions shared by all, now, my code is working fine. I attached the code.
Kind regards
Hasham
It doesn't look fine. It looks like a mess.
07-14-2024 10:30 AM
You need to stop splattering the same ugly code all over the forum. You can always link to the other thread if needed.
07-15-2024 06:13 AM
Hi,
Thanks for your reply.
Could you please guide me on how I could make it neat and clean with the same working? I know I put time elapsed and same time average option then display and save average values in a separate file and also saved RAW data as well.
Kind regards
Hasham
07-15-2024 07:36 AM
@Hasham622x wrote:
Hi,
Thanks for your reply.
Could you please guide me on how I could make it neat and clean with the same working?
The fact that you pose such a question means that you are incapable of seeing the messiness in your block diagram. Which means that you will never be able to understand the concept of neat and clean code.
07-15-2024 09:25 AM - edited 07-15-2024 09:28 AM
@Hasham622x wrote:Could you please guide me on how I could make it neat and clean with the same working? I know I put time elapsed and same time average option then display and save average values in a separate file and also saved RAW data as well.
There is a cleanup button in the toolbar, and if you press it and the diagram gets worse, you have "clean code" in my definition (In your case is gets an order of magnitude cleaner, meaning it was a horrible hairball before!
Here's your diagram and front panel, but I am sure you've seen it already. If you look up "messy diagram" on Wikipendia, you would probably find exactly this picture! 😄 If the number of wire bends is a very large multiple of the number of wires, something is wrong.
In comparison, here's how it could look cleaned up:
Here's how it could look (I don't have you serial stuff, so you need to again substitute that).
It is still not great to do file IO after the toplevel loop, because it will fail if the VI is aborted instead of stopped, but since you have all the non-averaged data saved, it can be reconstructed if needed.
07-15-2024 07:14 PM
Hi,
Thanks for your guidance and suggestions, and yes, you are right. My code is messy, and there are lots of wires of multiple colours that could confuse me. If you don't mind, could you please tell me if I want to run this same code by the FOR loop? I tried, and it was not working to execute the number of acquisitions for which I also put a separate post in this forum.
Kind regards
Hasham
07-15-2024 07:20 PM
Hi,
Thanks for your reply I could neat and clean this code, but still, my code is not completed due to that I am not giving it a final look as still I need to introduce constant value which should subtract from all average values and then also average values should be subtracted from each other like average value1 - average value2, average value3 - average value4, average value5 - average value6, ...
then I will give it final look. So, if you don't mind, could you please guide me on how I could subtract a constant from all averages and subtract between these averages?
a
Kind regards
Hasham
07-16-2024 12:52 AM
Hi Hasham,
@Hasham622x wrote:
how I could subtract a constant from all averages … ?
That is a very simple math operation, all you need is a subtract function and a constant…
@Hasham622x wrote:
and then also average values should be subtracted from each other like
average value1 - average value2,
average value3 - average value4,
average value5 - average value6, ...
Decimate your array of averages into two arrays, then subtract the 2nd array from the 1st…
07-20-2024 06:41 AM
Hi,
Sorry for disturbing you by controlling the while loop; I introduce a comparison function inside the loop, in which x represents required iterations and y starts from 0. As it reaches the required value, the loop will stop. Outside while loop from averages, first, subtract the same constant value from each average value, then subtract the average values like a veg Val1 - a veg Val2, .... Kindly please guide me if I am doing the correct stepping, or again I am making a mistake?
I also attached the LV code (LV19 version).
Kind regards
Hasham