Archive

Posts Tagged ‘matlab’

MATLAB error: libstdc++.so: version `GLIBCXX_3.4.15′ not found

Although I check with commands in terminal

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC

which shows version GLIBCXX_3.4.15 exists, MATLAB still repeats this error. After googling, I found that MATLAB searches the libraries firstly within its own library path /usr/local/MATLAB/R2012a/bin/glnxa64/ or /usr/local/MATLAB/R2012a/sys/os/glnxa64 and then the system library path. The build-in library is somehow out-of-date, and the version GLIBCXX_3.4.15 doesn’t exist in the old library. 

I tried to rename the build-in library into another name so that MATLAB can be forced to find the correct one, but there still many other candidates library files with the same name which are prior in the searching order. I need to rename all these old libraries with the same name to help MATLAB direct to correct one, which would be troublesome. 

Finally, I found an easy way to solve the problem by linking the correct library file with the MATLAB firstly searched old library file, i.e.,

sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 /usr/local/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6

After running this command in my terminal, the world calms down.

Matlab GUI的数据传递方式总结[zz]

matlab gui共有六种参数传递方式和范围各不相同

        1。运用gui本身的varain{}、varaout{}传递参数(注:这种方式仅适用与gui间传递数据,且只适合与主子结构,及从主gui调用子gui,然后关掉子gui,而不适合递进结构,即一步一步实现的方式)

              输入参数传递:
比如子GUI的名称为subGUI, 设想的参数输入输出为:[out1, out2] = subGUI(in1, in2)
在subGUI的m文件中(由GUIDE自动产生):
1.第一行的形式为:function varargout = subGUI(varargin)
该行不用做任何修改;varargin 和 varargout 分别是一个可变长度的cell数组(MATLAB帮助文件中有说明)。输入参数in1和in2保存在varargin中,输出参数out1,out2包含在varargout中;
2.在subGUI的OpeningFcn中,读入参数,并用guidata保存,即:
handles.in1 = varargin{1};
handles.in2 = varargin{2};
guidata(hObject, handles);
返回参数的设置:
1. 在GUI子程序的OpeningFcn函数的结尾加上uiwait(handles.figure1); figure1是subGUI的Tag;
2. subGUI中控制程序结束(如”OK”和”Cancel”按钮)的callback末尾加上uiresume(handles.figure1),不要将delete命令放在这些callback中;
3. 在子GUI的OutputFcn中设置要传递出去的参数,如 varargout{1} = handles.out1;varargout{2} = handles.out2;末尾添加 delete(handles.figure1); 结束程序。
在GUI的OpenFcn中,如果不加uiwait, 程序会直接运行到下面,执行OutputFcn。也就是说程序一运行,返回值就确定了,再在其它部分对handles.output作更改也没有效果了。
加上uiwait后,只有执行了uiresume后,才会继续执行到OutputFcn,在此之前用户有充分的时间设置返回值。
通过以上设置以后,就可以通过 [out1, out2] = subGUI(in1, in2) 的形式调用该子程序。
在一个GUI中调用另一个GUI时,主GUI不需要特别的设置,同调用普通的函数一样。在打开子GUI界面的同时,主程序还可以响应其它的控件。不需要担心子GUI的返回值被传错了地方。
Read more…

Categories: Matlab Tags: , ,