我有429个大小相同的数值矩阵(107行乘36列),分别存储在依次命名的this.obj = await this.api.getStoredUser();
//if(this.obj.length < 1) - gives me error too.. i've tried everything
if(this.obj !== null){ //------------ this line gives me error.
this.userObj = {
name: this.obj.fullname, // ------- this property gives me error.
email: this.obj.email,
phone: this.obj.phone,
skills: this.obj.skills,
unit:'',
church_id: this.obj.church_id
}
}
文件(例如.mat
)中。这是我需要做的:
到目前为止,我到了构建107 x 36 x 429阵列以填充我的矩阵集的阶段。
subj_00000.mat ... subj_00428.mat
但是我收到以下错误消息:
S = dir(fullfile(D,'subj*.mat')); % D is the path where the .mat files are saved
N = numel(S);
C = cell(1,N); % preallocate cell array
for k = 1:N
S = load(fullfile(D,S(k).name));
C(k) = struct2cell(S);
end
A = cat(3,C{:}); % join all of the original matrices into a 107x36x429 array
M = mean(A,3)
答案 0 :(得分:0)
您正在遍历S却每次都覆盖它。重命名循环内的S。当您使用它时,我会为您的所有变量赋予有意义的名称-无需每次都使用单个字母。 – svdc
谢谢!我重命名了
S = load(fullfile(D,S(k).name));
为
T = load(fullfile(D,S(k).name));
成功了