LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

initialize array from a constant string

I generated the coefficients for a FIR filter in Mathscript (250 taps).  I dumped the values to a data file and then "load"ed them into a Mathscript box inside my vi. 

This worked well until I created an executable version of my program (no Mathscript) where my coefficient vectors now come up Null.

My idea is to text copy the coefficients into a string constant in my vi, and then initialize my array as part of my start-up routines.

I was wondering if anyone has done this?  Is such a routine available anywhere?

Thanks,

Tom J
0 Kudos
Message 1 of 6
(3,369 Views)

How are you building the path the file that you are reading?

When you build an executable, the path of the VIs it contains changes.
In development environment, path to VI = c:\project\Top Level.vi
In executable environment, path to VI = c:\project\Executable.exe\Top Level.vi

So if the file you are reading is in the same directory as the executable, and you are building a path relative to that, you need to strip one more path level for the executable.

The above image shows one way to do determine programmatically if you are in the development or executable environment and how to strip the path an extra time for the RTE.

If this is not the problem, kindly ignore everything I just rambled on about.

Ed

Message Edited by Ed Dickens on 02-22-2007 10:36 AM



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 6
(3,347 Views)
Thanks to any who might reply.  This turned out to not be that hard using the "Scan from String" vi.

See attachment.

TJ
0 Kudos
Message 3 of 6
(3,338 Views)
Allowing the discussion to digress a bit (I've solved the original problem anyway), I was using absolute file paths not relative paths so I believe the files should have been found regardless.  You are right; however, in that my working and executable directories are different.

Does MathScript run within executable applications?  I believe the original problem was caused by my usage of a MathScript box, wherein I ran the command:
    load 'C:\LV_projects\#####.mlv'
to recall the data values stored with "Save Data" after executing my MathScript script file.  I then simply exported the vector of coefficients out of the MathScript box.  As I mentioned in my first post, this worked OK while "working/editing" but failed when running the executable.

Tom J
0 Kudos
Message 4 of 6
(3,334 Views)
Sorry for the mistake folks, but I forgot to make the Icon connections in my vi.  Please find the correct vi attached.

Tom J
0 Kudos
Message 5 of 6
(3,325 Views)
Grrr.  You try and add something as simple as error propagation and multiple errors creep in.  The NOR gate before the case box should be an OR gate.  The real FINAL version is attached.

Tom J
0 Kudos
Message 6 of 6
(3,319 Views)