LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change numbers on the table from decimal to integers?

I have been trying to make my code (attached) look like this below while it's running. Columns 2 and 4, numbers are rounded.

Table 2.PNG

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.

Table 3.PNG

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.

0 Kudos
Message 1 of 8
(1,405 Views)

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)

0 Kudos
Message 2 of 8
(1,398 Views)

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....

 

 

0 Kudos
Message 3 of 8
(1,390 Views)

Thanks Mr. Altenbach. I noticed the detour. Sometimes, it's the frustration of not getting what I want. So I changed it to this:

GRCK5000_0-1651862026495.png

 

 

0 Kudos
Message 4 of 8
(1,384 Views)

@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!!!!

0 Kudos
Message 5 of 8
(1,374 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 8
(1,366 Views)

@billko wrote:
In case you were wondering, Alt was referring to the fact that most nodes will work on arrays directly! 

Cough ... hhrmmmm...cough ...

0 Kudos
Message 7 of 8
(1,359 Views)

@altenbach wrote:

@billko wrote:
In case you were wondering, Alt was referring to the fact that most nodes will work on arrays directly! 

Cough ... hhrmmmm...cough ...


Yes, and while we are on that subject, why doesn't billko_0-1651874656965.pngaccept arrays?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 8
(1,327 Views)