LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interpolating 2D array

Solved!
Go to solution
Highlighted

Hello! I`ve written here earlier to help me to create programm for interpolating touchstone files with current (virtual power supply).

Thanks everybody who helped me with it.

Now I have problem because as it`s needed to create universal programm. I mean it`s need to upgrade this so it will work with any numbers of files with different values of current. I have touchstone files for 2,5,10,14 and 20 mA,so I need to do programm working with more or less number of files with different values of currents

Download All
0 Kudos
Message 31 of 49
(363 Views)
Highlighted

Hi Yolo,

 

so you already know how to interpolate between 2 files.

What is your problem to interpolate between data from more than 2 files?

What is the exact problem?

 

Your problem can be reduced to 2 steps:

  1. Determine the 2 data files needed for interpolation
  2. interpolate between those 2 files

For step 1 you can load all data files and determine the current they were measured with. These "current" values are used to solve step 1…

 

 

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 32 of 49
(299 Views)
Highlighted

Now programm is done to interpolate between 5 files. I mean,how can I make it to interpolate for example only between 2 or 3 files without changing block structure or maybe when I`d like to interpolate more than 5 files. And for example if it will be files for 3,7,9 or 13 mA. How can I upgrade it to regulate this in real time without remaking structure of .VI file every time I start new experiment with different files and different number of it ?

0 Kudos
Message 33 of 49
(290 Views)
Highlighted

Hi Yolo,

 


@HoloYolo wrote:

Now programm is done to interpolate between 5 files. I mean,how can I make it to interpolate for example only between 2 or 3 files without changing block structure or maybe when I`d like to interpolate more than 5 files. And for example if it will be files for 3,7,9 or 13 mA. How can I upgrade it to regulate this in real time without remaking structure of .VI file every time I start new experiment with different files and different number of it ?


As I wrote before:

In step 1 you load your data files and determine the values for your current. These current values are placed in an array.

When it comes to "S" interpolation you have your actual current value and the array of current values of those data files: now you can determine which 2 files are needed for the actual interpolation request. Using this information you can call a subVI (doing the interpolation) with these inputs: 2 data files and an actual current value…

 

It doesn't matter how many data files for which current values you have when you follow this algorithm.

The only requirement is to have atleast 2 data files to allow interpolation at all!

 

Edit after looking at your VI:

Generic advice: when you want to repeat the same code multiple times then you should use a loop. Using the same code 5 times to load and parse files is Rube-Goldberg - and very limiting as you just recognized…

More generic advice: NEVER DELETE THE LABEL FROM CONTROLS OR INDICATORS! (Emphasized because of importance…)

Even more generic advice: Don't upload such huge VIs, especially when 99% of the filesize is due to that image on the frontpanel! After deleting this image (which is irrelevant for you current problem) the VI was saved with just 34kB filesize…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 34 of 49
(283 Views)
Highlighted

But when I upload just 2 files in it it doesn`t work,because other file`s paths are empty.

I`m really sorry,but could you please show how it is needed to be upgrade to work correctly.

HoloYolo_0-1590597230382.png

HoloYolo_1-1590597250379.png

 

0 Kudos
Message 35 of 49
(245 Views)
Highlighted

@HoloYolo wrote:

But when I upload just 2 files in it it doesn`t work,because other file`s paths are empty.

I`m really sorry,but could you please show how it is needed to be upgrade to work correctly.

 


To find the solution, You have to take a step backwards:

 

You know how to interpolate between two files. Your program can do this.

 

You can now make a new VI with 5 inputs:

  • The Filename of File A
  • The Filename of File B
  • The Voltage of File A
  • The Voltage of File B
  • The Voltage X to interpolate.

 

When You have this Program, You make a second program with three inputs:

  • A List of Filenames
  • A List of Voltages
  • The Voltage X to interpolate

 

The task of the second program is:

  • Find the two files that you need to interpolate
  • Then use the first program:
    • Give to the first program the two filenames you need to interpolate, the voltages, and the target voltage X

You can combine two programs in LabVIEW.

0 Kudos
Message 36 of 49
(232 Views)
Highlighted

Hi Holo,

 


@HoloYolo wrote:

But when I upload just 2 files in it it doesn`t work,because other file`s paths are empty.


When you need to do the same task several times then you need to use a loop: no need to duplicate code!

This will read the content of your calibration data files into an array of clusters.

You didn't explain how to determine the value of the current the cal data file was created with: this will be the next parsing step in the FOR loop and should be bundle as an additional element into the cluster…

 

Did you read all the expplanations for the suggested algorithm? By now atleast two different people explained ("outlined") the proposed algorithm!

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 37 of 49
(194 Views)
Highlighted

Thank you! You really helped me to find solution of this problem,but now I just have problem that after loop for loading files when I set on out of structure tunnel mod for "Last Value" in array goes just last array,when I change it to "Index",It doesn`t work.

HoloYolo_0-1590928476156.png

 

0 Kudos
Message 38 of 49
(161 Views)
Highlighted

Your code has no resemblance to any suggestions her and makes absolutely no sense. Why would you branch that 3D array 5x and autoindex on the same 3D array 5x in parallel just to build it into a 3D array with now 5 times too many redundant points, then trying to wire that to a function that expects a 1D array??? Your inner FOR loop just repeats the same calculation N times, but N is not even wired. Then you have a while loop that spins as fast as the computer allows, never producing any output until the loop is stopped, which happens immediately because your termination condition is "unusual". If you would delete the while loop and stop button, nothing would change! There are much better ways to parse a number out of a filename than using "search and replace pattern" twice in a row. Pure Rube Goldberg!

 

Programming is not about adding more and more random stuff until wires are no longer broken. At this point you are not ready to do any of this. Start with some basic introductory LabVIEW tutorials first!

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 39 of 49
(154 Views)
Highlighted

Thank you for so much "usefull" information to solve the problem. If you've looked through the topic,you understood what I need to do in my program and saw the earliest version of it.

0 Kudos
Message 40 of 49
(147 Views)