[英]Matlab MemMapFile for a three dimensional matrix
我有一個尺寸為(232,232,3052)的三維矩陣,稱為“ Shanto”。
我想對此進行內存映射,並且正在使用以下命令:
fileID = fopen('Shanto.dat','w');
fwrite(fileID, Shanto, 'single');
fclose(fileID)
m = memmapfile('Shanto.dat')
但是,當我嘗試訪問m.Data時,會得到一個657083392 x 1 uint8數組。
我該如何做才能保留原始矩陣的(232,232,3052)形狀?
謝謝,
本
加載.dat
文件時,您可以指定形狀/格式(實際上默認為uint8)。 您還需要使用fwrite指定正確的數據格式:
fileID = fopen('Shanto.dat','w');
fwrite(fileID, Shanto, 'uint8'); %// Instead of 'single' as before.
fclose(fileID)
m = memmapfile('Shanto.dat','Format',{'uint8',[232 232 3052],'MyFancyName'})
然后,您可以使用m.Data.MyFancyName
訪問相應的3D數組
更多信息在這里
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.