matlab c++ 画图【转载】
生活随笔
收集整理的這篇文章主要介紹了
matlab c++ 画图【转载】
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原文:http://blog.csdn.net/owldestiny/article/details/4210177
最近有朋友問我他照著我之前的一篇文章(http://blog.csdn.net/owldestiny/archive/2009/03/07/3966340.aspx?)
做畫圖的時候畫不出來圖像,不知道如何解決,自己試了一下,搞定了在這里貼出來
首先matlab文件他是這樣寫的:
[cpp]?view plaincopy
C++代碼是:
C++代碼最后一句建議加上system("pause");
這樣如果程序運行過快最后還是能停下等待按鍵,就可以看到程序運行的結果;
加上之后控制臺中報錯為:
testWarning:?1?visible?figure(s)?exist?at?MCR?termination. If?your?application?has?terminated?unexpectedly,?please?note?that applications?generated?by?the?MATLAB?Compiler?terminate?when?there?are?no visible?figure?windows.?See?the?documentation?for?WaitForFiguresToDie?and WAITFORCALLBACKS?for?more?information. Warning:?Class 'graph2d.lineseries' in?use?at?MCR?termination. If?your?application?has?terminated?unexpectedly,?please?note?that applications?generated?by?the?MATLAB?Compiler?terminate?when?there?are?no visible?figure?windows.?See?the?documentation?for?WaitForFiguresToDie?and WAITFORCALLBACKS?for?more?information. Warning:?Objects?of?graph2d.lineseries?class?exist?-?not?clearing?this?class or?any?of?its?super-classes大致的意思就是圖片在退出MCR時仍然存在,這個是不允許的,terminate時MCR就不存在了,圖片也不可能繼續顯示,
解決的方法是將MCR存在的時間延長,可以在Matlab代碼中加入延時程序或等待按鍵代碼,我采用的是等待按鍵,
[cpp]?view plaincopy
最后一行就是等待鼠標按鍵,w變為0,循環終止,draw函數終止,MCR退出;
?
C++的代碼也進行了一點修改,
[c-sharp]?view plaincopy
這樣就可以實現了,具體代碼在這里(http://download.csdn.net/source/1341025?)可以下載到,,歡迎大家與我討論,mailto:chen0510566@163.com
總結
以上是生活随笔為你收集整理的matlab c++ 画图【转载】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C语言文件读写操作主要函数及其用例
- 下一篇: 【转】 LSD(Line Segment