2016-03-06 289 views
0

我不知道發生了什麼。我需要一些建議或解決此問題的MATLAB錯誤 - 對'int16'類型的輸入參數未定義函數「imrotate」

下面的代碼是:顯示這樣

ax_slice = reshape(im(:,:,slices/2),rows,cols); 
sag_slice = reshape(im(:,cols/2,:),rows,slices); 
cor_slice = reshape(im(rows/2,:,:),cols,slices); 
figure; 
subplot(2,2,1);imshow(ax_slice,[]); 
ax_slice_rot = imrotate(ax_slice,180); 
subplot(2,2,1);imshow(ax_slice_rot,[]); 
subplot(2,2,2);imshow(sag_slice,[]); 
sag_slice_rot = imrotate(sag_slice,90); 
imshow(sag_slice_rot,[]); 
subplot(2,2,3);imshow(cor_slice,[]); 
cor_slice_rot = imrotate(cor_slice,90); 
imshow(cor_slice_rot,[]); 

錯誤:

Undefined function 'imrotate' for input arguments of type 'int16'. 

Error in lab0_introduction (line 19) 
ax_slice_rot = imrotate(ax_slice,180); 

非常感謝您

+0

它是[圖像處理工具箱](http://nl.mathworks.com/help/images/ref/imrotate.html)的一部分。你沒有安裝或創建一個名爲'imrotate'的變量 – Adriaan

+0

要檢查是否安裝了這樣的工具箱,請在命令窗口中鍵入'ver'。將會彈出一些關於Matlab安裝的信息,以及所有安裝的工具箱列表。 – Alessiox

回答

0

正如其他人所說,這通常是因爲您沒有安裝Image Processing Toolbox。要檢查這種情況的最簡單的方式是鍵入以下內容:

which('imrotate') 

如果結果是這樣的說法

imrotate是一個變量。

然後,這意味着你不小心給了一個名稱的變量,所以MATLAB無法找到真正的功能。要解決這個問題,你需要運行下面的代碼。

clear imrotate 

然而,如果該which命令的結果是

「imrotate」找不到

這意味着你沒有安裝在圖像處理工具箱你目前的系統。

相關問題