创建或删除 Fortran 数组
创建指定类型的数组、分配和释放内存
使用 mxCreate*
函数创建 MATLAB® 数组。使用 mxCalloc
、mxMalloc
和 mxRealloc
函数分配动态内存。
每次使用 mxCreate*
函数或调用 mxCalloc
及关联的函数时,都需要分配内存。使用 mxDestroyArray
释放通过 mxCreate*
函数分配的内存。使用 mxFree
释放通过 mxCalloc
及关联的函数分配的内存。
Fortran 函数
数值
mxCreateDoubleMatrix | 2-D, double-precision, floating-point array |
mxCreateDoubleScalar | 将标量双精度数组初始化为指定值 |
mxCreateNumericMatrix | 2-D numeric matrix |
mxCreateNumericArray | N-D numeric array |
mxMakeArrayReal | Convert complex mxArray to real, preserving real
data |
mxMakeArrayComplex | Convert real mxArray to complex, preserving real
data |
字符
mxCreateString | 1-D array initialized to specified string |
mxCreateCharMatrixFromStrings | 2-D mxChar array initialized to specified value |
mxCreateCharArray | N-D mxChar array |
稀疏
mxCreateSparse | 2-D sparse array |
结构体
mxCreateStructMatrix | 2-D structure array |
mxCreateStructArray | N-D structure array |
元胞
mxCreateCellMatrix | 2-D cell array |
mxCreateCellArray | N-D cell array |
内存的管理
mxDestroyArray | Free dynamic memory allocated by MXCREATE* functions |
mxDuplicateArray | Make deep copy of array |
mxCalloc | Allocate dynamic memory for array, initialized to 0, using MATLAB memory manager |
mxMalloc | Allocate uninitialized dynamic memory using MATLAB memory manager |
mxRealloc | Reallocate dynamic memory using MATLAB memory manager |
mxFree | Free dynamic memory allocated by mxCalloc, mxMalloc, mxRealloc, mxArrayToString, or mxArrayToUTF8String functions |
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)