看板 MATLAB 關於我們 聯絡資訊
請問各位 請問我要顯示某個變數的職 比如說a的值的時候 希望顯示出的是 this is the answer = (a的值) 該怎麼做呢? 另外 我使用這個code y=input('y='); syms x x_sol=solve(x+y==1); disp(['a=' num2str(x_sol)]) 但是matlab一直回傳 Undefined function 'max' for input arguments of type 'sym'. Error in num2str (line 65) xmax = double(max(abs(widthCopy(:)))); 該怎麼解決呢? 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 97.80.118.239 ※ 文章網址: http://www.ptt.cc/bbs/MATLAB/M.1407291965.A.A4C.html
ejialan:1.disp + num2str 基本上就是你下面用到的那樣 08/06 10:59
ejialan:2.solve出來的變數型態是sym 要轉字串用char 也就是 08/06 11:01
ejialan:disp(['a=' char(x_sol)]) 還有solve裡面改成x+y-1比較好 08/06 11:02
Rasin: 建議不要用MATLAB解代數 08/10 23:48
Rasin: 要玩代數建議用mathematica 08/10 23:49
Rasin: 另外fprintf會比disp多功能 08/10 23:51