05-06-2022 12:57 PM
I have been trying to make my code (attached) look like this below while it's running. Columns 2 and 4, numbers are rounded.
Also, when I press "RESET C1" button, I would like column 1 to reset as shown below. It's a whole different story for me. Any suggestions or ideas? A picture or block diagram would be better because I am more of a visual learner.
I have tried different methods, I still can't figure out. The next move for me may be to expand my block diagram and just insert each random numbers individually into a table. I just don't like the idea of working with each random numbers individually because the code will get bigger and bigger. What if I have 10 or more random numbers, then working with each one would be headache. This is just the only idea I haven't implemented yet. Let me know.
Thank you!
Signature:
I am just a baby in LabView striving to grow.
05-06-2022 01:08 PM
As you have been told, a table is just a 2D array of strings. You have full control over formatting and content.
Just keep the table data (i.e. the 2D array) in a shift register anchored on the toplevel loop and do any array operation you want in any of the cases as needed.
Why do you have all these absolutely crazy detours, going from four DBLs to four strings to string array, to DBL array and back to string array? All you need is exactly two operations! (i.e. build array and format for the desired final string)
05-06-2022 01:30 PM
If you make the code scalable, there should be no real difference, no matter how many random numbers you need. Think loops!
While you explained what should happen if reset C1 is pressed, You do not specify what should happen at the next iteration after that.
You don't need any local variables and hidden indicators. The wire is the variable!
See if this can give you some ideas....
05-06-2022 01:33 PM
Thanks Mr. Altenbach. I noticed the detour. Sometimes, it's the frustration of not getting what I want. So I changed it to this:
05-06-2022 01:42 PM
@GRCK5000 wrote:
Thanks Mr. Altenbach. I noticed the detour. Sometimes, it's the frustration of not getting what I want. So I changed it to this:
So why not do the formatting after the build array? One "number to string" is better than four (or many more, depending on how many you have!)! Scalability!!!!
05-06-2022 01:47 PM - edited 05-06-2022 01:51 PM
@altenbach wrote:
@GRCK5000 wrote:
Thanks Mr. Altenbach. I noticed the detour. Sometimes, it's the frustration of not getting what I want. So I changed it to this:
So why not do the formatting after the build array? One "number to string" is better than four (or many more, depending on how many you have!)! Scalability!!!!
In case you were wondering, Alt was referring to the fact that most nodes will work on arrays directly! For instance, passing an array of doubles into Number To Fractional String will result in an array of formatted strings! How do you know which ones do and which ones don't? It's easiest to just hook them up and see if it works. Do read up on the detailed help for all of them that do seem to work, because sometimes there are caveats to watch out for.
05-06-2022 01:52 PM
@billko wrote:
In case you were wondering, Alt was referring to the fact that most nodes will work on arrays directly!
05-06-2022 05:05 PM
@altenbach wrote:
@billko wrote:
In case you were wondering, Alt was referring to the fact that most nodes will work on arrays directly!
Yes, and while we are on that subject, why doesn't accept arrays?