代码拉取完成,页面将自动刷新
function writemodel(modfile, model)
blocks = cell(model.numblocks, 1);
% filters
for i = 1:model.numfilters
if model.filters(i).flip == 0
bl = model.filters(i).blocklabel;
blocks{bl} = model.filters(i).w(:);
end
end
% offsets
for i = 1:length(model.rules)
for j = 1:length(model.rules{i})
bl = model.rules{i}(j).offset.blocklabel;
blocks{bl} = model.rules{i}(j).offset.w;
end
end
% deformation models
for i = 1:length(model.rules)
for j = 1:length(model.rules{i})
if model.rules{i}(j).type == 'D' && model.rules{i}(j).def.flip == 0
bl = model.rules{i}(j).def.blocklabel;
blocks{bl} = model.rules{i}(j).def.w(:);
end
end
end
% concatenate
m = [];
for i = 1:model.numblocks
m = [m; blocks{i}];
end
% sanity check
if sum(model.blocksizes) ~= length(m)
error('model size error');
end
% write to modfile
fid = fopen(modfile, 'wb');
fwrite(fid, m, 'double');
fclose(fid);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。