UNEMPTY

版本 1.0.0.0 (1.6 KB) 作者: Andreas
Sets empty fields in a structure to a defined value.
854.0 次下载
更新时间 2005/3/23

查看许可证

This function is useful if numeric values from a structure array are to be extracted using the notion M = S.field] UNEMPTY makes sure that empty matrices in the structure do not affect the size of M.

S = unempty(C) sets all occurences of empty matrices in all fields of C to NaN.

[S,nc] = unempty(C) reports the number of changed fields in nc.

S=unempty(C,F) sets in a structure array all occurences of empty matrices for field F to NaN.

S=unempty(C,F,value) sets all occurences of empty fields to value.

Example:

S=[struct('f',1) struct('f',2) struct('f',[]) ];
disp([S.f]) % size is different from S
1 2
S = unempty(S);
disp([S.f]) % size is the same as S
1 2 NaN

引用格式

Andreas (2024). UNEMPTY (https://www.mathworks.com/matlabcentral/fileexchange/7223-unempty), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R12.1
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Structures 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0