converting a file by referencing a dll for format (or calling a program to open and save as)
Show older comments
Hello,
I'm having an issue with file formatting for a nasty conglomeration of several ancient programs I've strung together for a very specific analysis of spectra. I have my data in CSV format, and I need to put it into SPC format. I've tried Matlab's GS tools for fast and easy conversion, but fast and easy doesn't look like its gonna happen here.
I have a program called Spekwin that has proven to put the data into the format needed for processing by the other programs if I first open the csv file in Spekwin and then save it as spc, but I'd really like a method through which I could automate this process using Matlab.
I believe the data outlining the rules for writing spc files with Spekwin is stored in a dll file within the program called 'gspciolib.dll' (correct me if this can't possibly be the case), so what I would like to do is tell matlab to turn my csv into an spc of the desired form by referencing gspciolib.dll.
Of course I am open to any method that will get the job done, so if there is some way to call the Spekwin program to open and save my csv file in spc format I'd love to hear about that as well.
Thanks in advance (there will be further thanks as well).
2 Comments
dpb
on 4 Jun 2015
I don't recognize the acronym "GS" for Matlab tools, but that's probably immaterial.
What's a SPC file format actually look like? Is it documented somewhere by the program? If so, it may be the simplest thing is to just write a routine to create the specific format needed.
Alternatively, if the program is an old DOS command line and will accept standard input/output by file redirection or will read input from a file, then you could potentially use the "bang" ("!") operator to spawn the program passing the appropriate inputs.
As for the DLL, anything is possible in what the developers did (altho I guess that also pretty-much removes the above of it being so old its a DOS app) and in theory if you know the interface to the routines exported by the DLL (and they or at least one of them) is the one that does what you need, then you could call it. To do so would take writing a mex function in C/Fortran that invokes the DLL and then call that mex function from Matlab. All in all, the other routes are likely far easier unless you have documentation from the vendor on the DLL as a user API; without that you're to the point of having to figure out what the interface is by reverse engineering the code entry points; no easy task.
pocketHands
on 4 Jun 2015
Answers (1)
dpb
on 4 Jun 2015
0 votes
Looks like these folks have a batch converter that should be able to make work...
Includes writing .mat files directly as well if that's the end game...
2 Comments
pocketHands
on 4 Jun 2015
Sure, that's what the "!" will do with the above utility presuming its batch mode can actually be initiated as a batch process....seems pretty useless if it can't be, but I notice in rereading the blurb it talks of "a few mouse clicks".
W/O that, looks like it's one of the other ways to interact directly; there does seem to be an open definition and some other APIs around from the looking I did.
I didn't find an actual spec but the Wikipedia link has the following link that says can get info on it from http://ftirsearch.com/Features/converters/SPCFileFormat.asp
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!