A(m,n,:,:) 切片返回值依然是個4D數組。
實驗如下:
谷歌查一下發現應該用squeeze函數才能返回一個二維數組:
參考:https://fr.mathworks.com/help/matlab/ref/squeeze.html
https://stackoverflow.com/questions/35225723/extracting-2d-array-from-4d-array-in-matlab
同理可知,只要通過切片指出了m維數組中n個維度的取值,再配合squeeze函數,就能得到m-n維度的低維數組