1
我試圖找到一個struct字段的類型。CLASS函數必須從類的構造函數調用
席力圖召prod
上我認爲是一個數組,但我得到這個錯誤:
??? Error using ==> prod
Dimension argument must be a positive integer scalar within indexing range.
所以我印有問題的對象,並發現這一點:
K>> F.val
ans =
0.110000000000000 0.890000000000000
ans =
0.590000000000000 0.410000000000000 0.220000000000000 0.780000000000000
ans =
0.390000000000000 0.610000000000000 0.060000000000000 0.940000000000000
哪個不同於陣列的輸出,這是:
K>> [0.11 0.89 0.59 0.41 0.22 0.78 0.39 0.61 0.06 0.94]
ans =
Columns 1 through 4
0.110000000000000 0.890000000000000 0.590000000000000 0.410000000000000
Columns 5 through 8
0.220000000000000 0.780000000000000 0.390000000000000 0.610000000000000
Columns 9 through 10
0.060000000000000 0.940000000000000
當我調用class
在對象上,我得到這個錯誤:
K>> class(F.val)
??? Error using ==> class
The CLASS function must be called from a class constructor.
我如何才能找到的F.val
類型?
在您的命令行中,哪個類的輸出是什麼? – Shai
我猜'F.val'是一個單元陣列。你可以用>> iscell(F.val)'來檢查。要將其轉換爲數組,您可以簡單地使用'>> [F.val {:}]' – Shai
如果您願意,還可以在GUI中深入查看結構 - 雙擊工作區變量窗口或'openvar( 'F')' – Notlikethat