看板 MATLAB 關於我們 聯絡資訊
大家好 大家晚安 假設我有以下資料 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 以上為 (i,j)值僅有{0,1} 3*8的double型態 想要的到 00000000 00000001 10000000 欲得 把(i,1)到(i,8)抓起來在一起 3*1的uint8 3*1的char 我知道uint8()跟char()的function 可是 轉出來依舊還是3*8矩陣 感謝大家 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.171.78.110 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1427630015.A.C3F.html
celestialgod: 猜char(matrix), matrix是3*8的矩陣 03/29 21:58
Lionel: 不是喔 我有是過 出來是3*8 03/29 23:13
celestialgod: char矩陣本來就是3*8阿 一個字元是一個空間 03/29 23:23
celestialgod: 你要3*1只能用cell 應該是 cellstr(char(matrix)) 03/29 23:23
celestialgod: 抱歉一開始沒看到最後兩行...你試過了。Y 03/29 23:24
??? Error using ==> cellstr at 34 Input must be a string. Error in ==> TEST1 at 5 Q=cellstr(uint8(Matrix)) 還是不行耶 好複雜~"~ ※ 編輯: Lionel (118.171.69.111), 03/29/2015 23:31:13
profyang: 推3F char出來不可能是3*1 除非例如你10000000已經變128 03/30 00:01
profyang: 但那樣也不會是3*1 總之要用cell存才有可能 03/30 00:05
celestialgod: http://pastebin.com/cHeKBGxX 我覺得我用的很複雜 03/30 00:10
physbook: str2num? 03/30 00:12
celestialgod: 改這樣比較簡單 http://pastebin.com/UjDNGm5z 03/30 00:22
celestialgod: 剛貼錯程式 http://pastebin.com/stqhkDN7 03/30 00:23