Extracting table from data structure
3次观看(最近30天)
Show older comments
Hello,
我有多级.mat文件,从这些文件中我想提取具有可变名称B(500000×1 double)的表。首先,我使用s = dir('*。mat')加载了数据;然后我使用conson k = s.b;要从表变量名称B提取数据B。这个commond不起作用,而是给我这个消息:引用不存在的字段'b'..您能指导我哪个commond我将使用哪个commond从数据结构中提取表数据。
br
Haresh Kumar
答案(2)
Hiro
2021年4月6日
First thing you should do is check if S is a table variable.
If it turns out to be a table variable, then the next thing would be running the following command to check if B exists
s.properties.Variablenames
Good luck.
Steven Lord
2021年4月6日
首先,我使用s = dir('*。mat')加载了数据;
The
dir
功能
does
not
load data. All it does is generate a list of files in the directory with the .mat extension. To load the data you'll need to use the
load
功能。然后,如果要检查加载数据是否包含一个名为b的变量(已加载到输出的字段中
load
you can use
isfield
.
data = load('census.mat')
doesItHaveAVariableB = isfield(data,'B')
doesItHaveAVariableCdate = isfield(数据,'cdate')
0 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
开始狩猎!