02-11-2022 09:44 AM
I'll figure something out eventually.
02-11-2022 10:09 AM
@User002 wrote:
Wouldn't that be using Boolan logic?
What exactly do you consider Boolean Logic?
Are comparisons acceptable to use?
02-11-2022 12:01 PM
You might want to re-think your general forum approach. Spending 50% of your answer dismissing posts by others is a sure way to prevent most people from answering. It really (really!) helps to be polite and thankful and I am sure you'll learn that eventually. Some of those are the best programmers anywhere and had valid concerns. Your own advice to them was not to answer, but you seem to answer every single one of them, violating your own rules!
Back to the original problem:
Now sit down and write five different programs that solve your problem. A few with your special rules and a few without any special rules. Show us your solutions and we will show what can be improved, putting you on the fast track to become a better programmer. Take the opportunity! 😄
02-11-2022 12:22 PM
Here is a roundabout of limiting the array size:
02-11-2022 12:44 PM
@Gregory wrote:
Here is a roundabout of limiting the array size:
But you are not using a FOR loop and there is a green wire!
Here's a "solution" exclusively with FOR loops and nothing Boolean at all: 😄
02-11-2022 01:18 PM - edited 02-11-2022 01:27 PM
@User002 wrote:
I want to build an array of a certain size by loops stopping when the array is full. I have to use a for loop and not use Boolean logic. I feel there's a connection to be made with the iteration count and count terminal but can't quite figure it out.
If you don't want to have a discussion then I suppose I'll just answer your question, though it seems contrived and nonsensical:
No. LabVIEW arrays do not have fixed sizes and cannot be "full". The size of the array is determined by how many elements are in it. If I have an array with 12 elements, it is of size 12, and I can always add more elements to make it size 13, or 14. In that sense an array is always "full" but can always be expanded.
Edit: Thought of an analogy. A LabVIEW array is not like a container that can be filled. An array is more like a stack of Legos. Your question is basically "Can I make a stack of Legos that is 12 bricks tall, then begin filling it and stop when it's full?" Your question implies a misunderstanding of how LabVIEW handles arrays. Other languages DO have fixed-size arrays, but LabVIEW does not.*
*To the pedants out there, yes LV FPGA has fixed size arrays and regular LV has fixed size queues, but I don't think that's what we're talking about here ;). The OP didn't say "how do I implement a fixed size array functionality", he/she said "can I fill up an array", and he/she doesn't seem to want to discuss the actual requirements.
08-17-2022 03:57 PM
Sorry to revisit this ...
Lets say I only wanted to use the last 10 records (rows) of an array. I know how to arrange the array from ascending / descending depending on the sorting a column (field).
How would you only grab a set number of records? Lets say the last/first 10 of an array.
I was trying to build an array with a for loop with a initialize set at the first input. My attempt to manipulate or limit the number of records has not been fruitful. Has anyone tackled this?
08-17-2022 09:02 PM
It would be very helpful to give a detailed example. You talk about sorting. Is that done once or can the sorting change later? How do you sort?
What's the datatype?
It is completely unclear how you manipulated unsuccessfully.
Once you explain in detail what "this" is, we can most likely offer a solution.
Please attach a small vi and some typical data.
08-18-2022 10:33 AM
I was finally able to limit the number of desired records from an array using a for loop and an Insert into Array.vi
This was done on LV 2019.0.1f4 (64 bit)
08-18-2022 11:31 AM
"excel sort data" is broken for me. Can you run your VI once until "all data descending" contains entries, then select that indicator and "edit...make selected values default. Now delete all excel code and turn the above indicator into a control ("right-click..change to control").
Save under a new name and attach it once more.
Now we have a runnable VI and can test the rest of your code. Seems extremely convoluted and I am sure there is a much better solution! trust me!