Jump to content
News about the LabVIEW Wiki! Read more... ×

torekp

Members
  • Content Count

    200
  • Joined

  • Last visited

  • Days Won

    2

torekp last won the day on January 3 2018

torekp had the most liked content!

Community Reputation

7

About torekp

  • Rank
    Very Active

Profile Information

  • Gender
    Male
  • Location
    SE Michigan

LabVIEW Information

  • Version
    LabVIEW 2012
  • Since
    2001

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks! Sorry, I wasn't clear. I'm not trying to use a DLL in Labview. I'm trying to use a DLL (that Labview created) in C++. I read the first website on the "C Struct Hack" and tried to apply it to your advice, yielding this: int i; int len = 2, len2 = 3; int32_t datasz[2]={2,3}; double data1d[6] = { 1,2,3,11,12,13}; double aresult[2][2]; DoubleArray dataouta; DoubleArray datain; void viGet(DoubleArrayBase * result) { for (i=0; i<4; i++) aresult[i/2][i%2] = (result->element); } void viSet(DoubleArrayBase * myArray) { (myArray->dimSizes)[0] = 2; (myArray->dimSizes)[1] = 3; for (i=0; i<6; i++) (myArray->element) = data1d; } int main(int argc, char *argv[]) { viSet(datain); Linear_discrim_4dll(&datain,&dataouta,len,len2); viGet(dataouta); ) and some printf statements. This compiles (yay, a first!) but has a Fatal Runtime Error dereferencing a null pointer to datain, at the call to viSet.
  2. So I created a DLL from a Labview VI that has a 2D array input (and some scalar inputs) and some 2D array outputs. Labview creates a .h file with these lines And then it defines the 2D array arguments to my function as being of this type: "void __cdecl Linear_discrim_4dll(DoubleArray *dataObsFeat, int32_t grpAsz," etc etc. Trouble is, I have no idea how to fill out this structure so that the DLL can use it. Say for simplicity I had a 2 by 3 input called dataObsFeat with elements {1,2,3; 11,12,13}; how would I create the object with these values in C or C++ and pass it to the function? I am a total C++ noob, in case it isn't obvious.
  3. Ah, thank you! I tried this guy's advice item number 7 and it worked. A bit brute-force, but maybe that's OK. (I'm not using typedefs.)
  4. Yes it was. However my only other option for where the .chm file goes is "same as caller", which also fails.
  5. So, according to this NI document http://zone.ni.com/reference/en-XX/help/371361L-01/lvhowto/linking_vis_to_help_files/ It should be possible to link a .chm file into your executable so that a user can choose Help > Help for This VI. Well, I followed the advice, and no dice. Here is my LV2017-64bit attempt. In the development environment, it works fine, but in the executable Help for This VI is grayed out. The .chm file is a poor excuse, and unrelated to this VI, but never mind that, it's not the problem here. LV17helpEx.chm html_help_VI.vi test_help_html.aliases test_help_html.lvlps test_help_html.lvproj
  6. Supposedly there are Labview tools available at http://www.lvs-tools.co.uk/software/utilities/ But whenever I try to register or login, nothing happens. (Also, I try to think, but nothing happens.) Are there any other Labview codes that use the Windows Memory-Mapped Files functions, or should I just reinvent this wheel? By the way, here is a Microsoft document on the subject: https://msdn.microsoft.com/en-us/library/ms810613.aspx
  7. torekp

    Graph high dimensional data in 2D graph

    Thanks guys! I'm downloading the matlab style package now. The primary user is me, actually, and I chose my scheme so that it's easy to ignore everything but color, which groups things nicely. It is a little more convenient for me to graph every particle on one graph, but maybe it would make better sense to have two graphs, one per location. Good idea. Thanks again.
  8. Here is a graph I made recently, which shows particle number (symbol), material (broad color family), measurement location (exact color), amplitude (X axis) and phase (Y axis). That's five dimensions in a 2D graph! There are some obvious limitations. For instance, there are only 16 symbols, so whatever you're representing by choice of symbol better not have more than 16 categories. And there are only so many colors, especially if you want them all to be ordered in a spectrum from red to violet. It gets worse when you try to have "broad color family" like I do here with reddish colors for aluminum and bluish for titanium, because the obvious logical thing to do is to skip over some shades in between the families, reducing the total number of available colors. What other options should I consider? How do you do it? I don't usually use 3D graphs because (a) they're harder to work with and (b) when I create a report for management, they like to have 2D images they can print out, or view without needing Labview on their computer. I'm attaching two VIs I use to create color spectra for my graphs. I use colors_darken_lighten to darken plots for a white background. To skip over colors, I obtained 6 colors in my spectrum and reshaped the array to two-by-three, then indexed by measurement location to get the first two colors from each broad color family. colors_darken_lighten.vi plot_color_spectrum.vi
  9. I'd like to make true XY graphs in Excel, where each data series has its own set of X values and Y values. Unfortunately, interleaving rows of X data, Y data, X data, Y data, etc., won't do it: only the first row counts as X data. And "updating graph data" as shown in this block diagram, doesn't work like I'd hoped. That VI should be called "overwrite graph data" not just "update". Am I overlooking something in the Report Generation toolkit? Ultimately, what I really want is to print an XY graph and have the printout scale to fit the page, be oriented nicely, etc. Saving the graph as a .PNG programmatically is cool and all, but the Windows program to view PNGs doesn't print well. Right-clicking the graph and saving to a .BMP leads to similar issues. Right-clicking and exporting the data to Excel allows me to laboriously construct an XY graph data-series by data-series, which then prints nicely. Keyword: laboriously. Suggestions?
  10. torekp

    Sorting Raw Serial Data

    Can you post a (or two or three) typical data string(s)? Usually strings like this have a delimiter, like commas or tabs or spaces, to separate the numbers. So you could do this: I showed the example with comma for the delimiter, but other possibilities are shown above (not wired in). When you create the array type on Spreadsheet String to Array, be sure to right-click the resulting array and select Remove Dimension. Because it sounds like you're getting a 1D array, not a 2D.
  11. torekp

    Support Vector Machine classifier

    The github files appear to contain only a vipb file, not a vip file. I was able to build a vip file in LV2015+VI Package Manager, but no DLLs appeared. I tried installing the attached DLL files in the zip into vi.lib/oysstu/... , but when I opened the example VI in the "dense" category, it wanted a different DLL named LabVIEW-libsvm-dense.dll. I tried linking to the DLL from the zip file named LVLibSVM.dll instead, but while the broken arrow went away, it generate a 1097 error on running. (1097=problem in external code linked by Code Interface Node.) This is on Windows XP 32-bit, using the DLLs in the x86 folder.
  12. torekp

    Support Vector Machine classifier

    Hello Laely, sorry I didn't see this earlier. I haven't been that regular on lavag.org lately, but I'll try to show up more often for a while. I'd be happy to help, but I've only been able to make the old interface work, not the one posted by oysstu. If you download from my post#3 in this thread, then extract that zip to any folder (say C:\Laely), then open the VI in the top level folder, it should work for you. Just change the start path to your folder (e.g. C:\Laely\Color_SVM_3d Folder\Color_SVM_3d Folder\data) before running. The code is written in LV 8.5. Press the buttons Read, Make Model, View Model, etc. in order. When you Read (the data) select the file AsandBs.txt. A popup VI will ask you to name the two categories - put any names you want. If you want to make your own data file, look at the format of AsandBs.txt. The category goes in the first column. The classification must be binary; only zero vs nonzero in the first column will make a difference.
  13. torekp

    Statistical modeling example code

    The above PLS code has been corrected for one error. Below I attach the one corrected VI. Other errors might remain. PLS1.vi
  14. torekp

    Support Vector Machine classifier

    Thanks oysstu. I'm having the same problem as zhengenhao2. Trying to use one of the Example VIs, it asks me to locate LVlibSVM.dll, but no such file seems to exist. This is for 32-bit Labview 2014. The default path where it tries to look, is in the folder that contained the VI Package Builder, in a subfolder called .Labview - note the dot. No such subfolder exists.
×

Important Information

By using this site, you agree to our Terms of Use.