calling cfityk from Matlab?

177 views
Skip to first unread message

Dan Parshall

unread,
Mar 27, 2012, 1:47:00 PM3/27/12
to fityk...@googlegroups.com
I'm trying to make some fairly complicated 2-D and 3-D plots, so I'm wanting to use cfityk as the curve-fitting engine, but use Matlab for most of the other stuff.

Currently, I can generate a .fit script with Matlab, which can be executed either with the fitfk GUI, or via cfityk (using 'cfityk exec fit_script.fit' from the command line).  In both cases it works just fine, and exports the data I need via a call 'info peaks_err >> info_out'

However, if I try to call the script directly from within matlab, via:
system('cfityk exec fit_script.fit')

then Matlab generates the following errors:
cfityk: /home/MATLAB/R2011a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by cfityk)
cfityk: /home/MATLAB/R2011a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libfityk.so.3)
cfityk: /home/MATLAB/R2011a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libxy.so.3)

It seems like cfityk is looking for some library files within some bizarre combination of my /home directory, or the Matlab directory.  I'm not entirely sure why, or why the base path seems to be '/home/' rather than '/home/dan/'

Is there some command-line option to tell cfityk where to look for the libraries?  Or am I completely off-base?

I'm using fityk 1.0.1 on Ubuntu 10.10

Thanks!
--
Dan Parshall
Shorty George Productions
Boulder, CO

Marcin Wojdyr

unread,
Mar 27, 2012, 1:55:17 PM3/27/12
to fityk...@googlegroups.com
Does cfityk work from command line? (without matlab)

Is `exec' a filename in 'cfityk exec fit_script.fit'?

Marcin

> --
> http://groups.google.com/group/fityk-users

Dan Parshall

unread,
Mar 27, 2012, 2:05:15 PM3/27/12
to fityk...@googlegroups.com
cfityk works fine from the command line.  I had thought it was necessary to use 'exec' when calling cfit to execute a script.  Looking at my logs, I see that it was trying to parse 'exec' as a filename, and was just moving on to the .fit script.

I tried using cfityk without the the 'exec' call, i.e.:
cfityk fit_script.fit

which works just fine on the command line.  As before, however, it does not work when called from within Matlab, and generates the errors listed in my initial message.

Dan

Marcin Wojdyr

unread,
Mar 27, 2012, 2:16:03 PM3/27/12
to fityk...@googlegroups.com
It's matlab problem: https://bbs.archlinux.org/viewtopic.php?id=86809
apparently matlab is shipping with own version of libstdc++ library
and is forcing called program to use it.
It should be possible to make it work.
You may change matlab libraries, or you may try
system('LD_LIBRARY_PATH=/usr/lib64 cfityk script.fit')
I don't know how exactly matlab is making cfityk to use libraries from
/home/MATLAB/R2011a/sys/os/glnxa64/.

Marcin

> --
> http://groups.google.com/group/fityk-users

Dan Parshall

unread,
Mar 27, 2012, 2:25:34 PM3/27/12
to fityk...@googlegroups.com
using:

system('LD_LIBRARY_PATH=/usr/lib64 cfityk script.fit')

worked just fine.  Thank you!

Marcin Wojdyr

unread,
Mar 28, 2012, 6:06:41 PM3/28/12
to fityk...@googlegroups.com
Would you be interested in using fityk from matlab more directly?
I'm working on C interface to libfityk and in the next version it
should be possible to use loadlibrary and calllib in Matlab to access
fityk functions.
The C API contains a general fityk_execute() function that takes
string with fityk command and executes it and a few more specific
functions for loading data, calculating value of expression, etc.
Current API is here: https://github.com/wojdyr/fityk/blob/master/src/fityk.h

If anyone has any comments or use cases, let me know. I'm still
thinking how the API should look like.

Marcin

Reply all
Reply to author
Forward
0 new messages