07-03-2024 07:24 PM
@Hasham622x wrote:
sorry, my bad data is in 12-bit format 0 to 3000
There is no 12 bit datatype, but it seems to arrive as U16, even if not all bits are actually used. (12 bits allows 4096 different values)
I have asked you many times to attach a simple string as received, why don't you. Run your VI until "buffer" displays valid data. Stop the VI. Right-click the buffer terminal and "create constant". Copy that constant to a new VI and attach it here (LabVIEW 2020 or below).
07-04-2024 06:13 AM
Hi,
Thanks for your reply,
I attached old version of code.
Kind regards
Hasham
07-04-2024 06:34 AM
Hi,
Thanks for your reply. if you don't mind, could you please guide me as I did not get these points as I am not good in selecting appropriate subVIs and trying my best to learn them.
so, it means the averaging part remains outside of the main while the loop
How I could run both VIs
please guide..
07-04-2024 07:06 AM
@altenbach wrote:
- Why do you think you need three autoindexing output tunnels and three transpose arrays instead of branching after the transpose operation?
- Why do you have terminals with no labels? It is a bad habit to set labels to an empty string. You can always show the caption or hide the label on the front panel, but they need to show in the diagram to avid confusion!
- Taking the array sum of U16 can easily overflow (wraparound), so don't do that! The solution with the mean is all you need.
- In what way is the result wrong? Is the U32 data correct? Maybe you have the wrong byte order?
- Please use my technique! 80% less code and easier to maintain and debug.
- Autoindexing on a while loop output can be problematic, because you will run out of memory if the program runs forever. Also, if you abort the VI (instead of correctly stopping the loop), all data is lost forever!
- Please do not maximize the front panel to the screen. Super annoying!
- Do a few more basic tutorial and simplify, simplify!
- etc. etc.
As an example, let's have a look at your inner loop. All three produce the same output, but some versions are arguably simpler!
I'll take a stab at some of your questions.
Some of my former cow-orkers either couldn't, or wouldn't bother to, think things through.
Their approach seemed to be to semi-randomly toss something together, then hack at it until it worked. And that was the only thing they cared about; nothing else mattered.
They never had any interest in learning anything unless it would solve an immediate problem.
One of them would produce code so twisted and convoluted that I wondered if he had a psych problem (schizophrenia? psychosis? psychopathy?). I kind-of lean toward psychopathy because at a personal level, he seemed normal.
07-04-2024 09:04 AM
Hi Hasham,
@Hasham622x wrote:so, it means the averaging part remains outside of the main while the loop
How I could run both VIs
please guide..
As you have problems doing basic steps in LabVIEW I recommend you start with Training courses offered at the top of the LabVIEW board!
Proceed with your VI once you have done those courses…
Creating/using subVIs and setting default values is VERY basic LabVIEW stuff!
07-04-2024 09:22 AM
@Hasham622x wrote:
- Attach the subVI so we can debug it…
You now attached three different VIs, all with exactly the same file name. Trying to sort out your attachments is like herding cats. I won't be sorting through all that to see what the differences are and what could possibly the one we are supposed to look at. You need to keep your ducks in a row and never attach the same VI twice and give each attachment a unique name so we can immediately see what's newest.
07-04-2024 09:58 PM
Hi,
Thanks for your reply. I attached the same code with the 2020 and 2019 older versions.
07-10-2024 10:50 PM
Hi,
First of all, thanks for the guidance. I tried both options to simplify the code. A Simpler approach is working, and the best approach, unflatten/flatten sub VI based, is not working in which I am making any wrong connection within a FOR loop / conditional loop due to that it is giving only for columns of an array whose all values are zeros.
I attached both codes (LV19) with this message.
Kind regards
Hasham
07-10-2024 10:51 PM
Hi,
First of all, thanks for the guidance. I tried both options to simplify the code. A Simpler approach is working, and the best approach, unflatten/flatten subVI based, is not working in which I am making any wrong connection within a FOR loop / conditional loop because it is giving only for columns of an array whose all values are zeros.
I attached both codes (LV19) with this message.
Kind regards
Hasham
07-12-2024 02:49 PM - edited 07-12-2024 02:51 PM
Your code is still completely wrong. Why would you use a FOR loop to do the exact same operation 16x in a row and using a shift register where you never read from it?
Nobody ever told you to unflatten to a 1D DBL array. My example had a 1D U16 array as type, right? And why would you convert your string to a byte array just to convert it back to a string (16 times!!!) a nanosecond later???
You need to go back to the basic tutorials and understand the difference between datatypes. We are not getting anywhere.