如何从Matlab调用Qtproject? [英] How can I call a Qtproject from matlab?

查看:486
本文介绍了如何从Matlab调用Qtproject?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在matlab中有一个函数,可以写入我在qt项目中使用的file.txt.

I have a function in matlab that writes a file.txt which i use in my qt project.

所以

当我得到一个使用unix()运行的qt编译可执行文件时,我有一个Matlab文件,但是出现错误.

I have a Matlab file when I get a qt compiled executable to run using the unix(), but I'm getting an error.

代码:

unix('/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui');

错误:

/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui: symbol lookup error: /home/matt/Desktop
/PlaneVolumeFinal/PlaneVolumeGui: undefined symbol: _ZN9QListData7detach3Ev

推荐答案

这个问题,正如@grungetta指出的那样,可能与MATLAB本地库路径没有看到您的Qt库有关,例如libQtMultimedia.so,通常应该如此在通过LD_LIBRARY_PATH var在任何shell会话中可见的路径中.

The problem, as @grungetta is also pointing out, may be related to MATLAB local library path not seeing your Qt libraries, like libQtMultimedia.so, which should normally in a path visible in any shell session through LD_LIBRARY_PATH var.

解决此问题的一种方法是在MATLAB运行的会话中显式设置LD_LIBRARY_PATH的值(如果需要继续,则重新存储它).用于您的MATLAB脚本的一组示例命令可能是:

One way to work around this is explicitly setting the value of LD_LIBRARY_PATH from within a MATLAB running session (and then re-storing it if you need to continue). An example set of commands for your MATLAB script may be:

%*** save local (MATLAB's) LIBRARY PATH
libPathLocal = getenv('LD_LIBRARY_PATH');  

%*** set your global LIBRARY PATH 
PATH_LD_LIBRARY = '/usr/lib/' % or any string containing library files required 
setenv('LD_LIBRARY_PATH', PATH_LD_LIBRARY); 

%*** call binary through 'unix' or 'system'
system('/home/matt/Desktop/PlaneVolumeFinal/PlaneVolumeGui'); 

%*** restore session's MATLAB's library path
setenv('LD_LIBRARY_PATH', libPathLocal); 

这篇关于如何从Matlab调用Qtproject?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆