03-05-2024 01:26 AM
Hello
I want to run this vi.
How to solve this error?
03-05-2024 01:29 AM - edited 03-05-2024 01:32 AM
Hi wnsl,
@wnsl7063 wrote:
How to solve this error?
Wire an integer numeric value to the N input of the loop...
The error message is quite clear: why don't you follow its explanations?
Why do you need to open and close the VISA resource in each iteration?
How many samples do you want to measure?
Do you really need this inner FOR loop when you already have the while loop around?
03-05-2024 01:54 AM
Thank you, sir
I just want to receive measurements from a multimeter every second and write them to a text file.
I used a FOR loop to write the seconds in the first column of the array.
Is there any other way to achieve this?
03-05-2024 03:10 AM - edited 03-05-2024 03:12 AM
Hi wnsl,
@wnsl7063 wrote:
I just want to receive measurements from a multimeter every second and write them to a text file.
There is no timing in your FOR loop: how do you want to measure "every second"?
Why do you need to (over)write the WHOLE file in each iteration? Wouldn't it be sufficient to write the file ONCE after the loop?
@wnsl7063 wrote:
I used a FOR loop to write the seconds in the first column of the array.
Why do you need a FOR loop to place "seconds in the first column"?
Why do you rely on loop iterator for a time measurement?
Why do you use a FOR loop when you don't know the number of needed samples BEFORE you enter the loop?
@wnsl7063 wrote:
Is there any other way to achieve this?
Surely yes.
There is a loop around your case structure and you seem to use a state machine: why not call the same state (to measure one sample) once a second?
03-05-2024 09:19 AM - edited 03-05-2024 09:22 AM
I will refrain from piling on more comments to what has been said already, especially since we only see part of the diagram. A truncated picture leave way to many things unknown. Sometime we can tell from a picture what's wrong, but a more precise diagnosis requires the VI. (It is rare that we can tell all problems from a picture)
It seem completely pointless to use an xy graph if the x values are just counting with x0=0 and dx=1. This is redundant information and your first column can be determined at any time just from the array or line index in the file. You are clobbering the code with complicated data structures for no reason.
Why would you write an ever-growing array from scratch to a file if most data has already be written in earlier iterations? All you need to append is the new data.
Is the only reason for the FOR loop that you need something to anchor your shift register? Maybe that shift register belongs on the toplevel loop instead.
If you want any constructive comments from me, attach your VI.