02-26-2015 12:48 AM - edited 02-26-2015 12:50 AM
How to get inputs (in number) from external text file to run a mathematical equation with each input?
Get VI to read from a file that contains multiple radii (i.e., each line in the file should contain one radius) . The front panel should allow the user to input the specific the number of radii contained in the file.
The VI should:
1.Get the user input (the number of radii in the file;
2.Open the file;
3.For each radius in the file, the VI should calculate the volume of the sphere and write it to anew line in an output file called volumes.txt
Please if possible upload an example.
.
02-26-2015 01:07 AM
Yes you can do it.
Try & post your code. Ask if your facing problem.
02-26-2015 01:13 AM
02-26-2015 01:19 AM
If your file size less, read your data at once (using Read From Speadsheet File vi). You will get array.
Get that array & use For Loop to calculate volume.
03-02-2015 10:28 PM - edited 03-02-2015 10:30 PM
Thank you, but I still don't know how to make it to read all data, and run vi to find all volumes without me identifing which row to read.
03-02-2015 10:39 PM
Is this homework?
You've been given all the information you need to get started. If you don't know how to act on that info, then I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
03-02-2015 11:17 PM
Have you even tried doing what he suggested? If so, why haven't you posted the VI to show where you'er getting stuck. If not, of course you don't know how to make it work.
03-03-2015 01:12 AM
just to make mure that I actually did tried his suggestion.and I'm stuck here. I can save data one by one by telling it which row (or after how many charechters) to read and then write. I can't make it to read all and write all volumes.
03-03-2015 02:13 AM
03-03-2015 02:39 AM
Dear azhiqaradaghi
Read your data at once (if file size is less). Based on your input file, you need to define delimiter (most of the cases “comma”) & no need to provide any other parameters (offset n all). You will get 2D array as output.
From 2D array, get your required data (using index array).
Pass your 1D array (output of index array) to For Loop & calculate Volume for every value. Take the For loop output & write it to file.