how to save mutiple files where each file store output of NN train method?

조회 수: 4 (최근 30일)
A
A 2013년 12월 3일
댓글: A 2013년 12월 3일
for i=1:20
% some stuff for net, P and T
var= train(net,P,T);
currentFile = sprintf('var_%d.mat',i);
save(currentFile,'var');
end
files are made with common variable names and thus problem in loading the files in different scripts for sim method.
Thanks in advance!

채택된 답변

Walter Roberson
Walter Roberson 2013년 12월 3일
That code should be fine for writing different files, each of which has the save variable name "var".
If you want to load multiple "var" into the same MATLAB session, instead of using
load('var_9.mat')
(for example), use
var = cell(20,1);
for i = 1 : 20
currentFile = sprintf('var_%d.mat', i);
T = load(currentfile);
var{i} = T.var;
end
The result would be cell array, var, with var{9} containing the values from var_9.mat (for example)
  댓글 수: 2
A
A 2013년 12월 3일
Thanks. But problem comes when I use:
T = load(currentFile);
var{id} = T.var;
[a b]= sim(var{id},testData);
A
A 2013년 12월 3일
It worked...my testData need to be double! your solution works thanks!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by