Borrar filtros
Borrar filtros

How can I properly load a file from current folder to workspace?

3 visualizaciones (últimos 30 días)
Dear all
I have this code:
%
if exist ('netrb')
load netrb
disp('Neuronová síť byla načtena')
else
load trenovaci_modely1
disp('Trénovací modely byly načteny')
P = [c{1,:}];
T = [c{2,:}];
net = newrb(P,T,0,0.3);
end
save netrb net
disp('Neuronová síť byla uložena')
I would like to load netrb from my current folder, but always when I run this code, it starts to train network as if none exist in my folder. Please advise me, what´s wrong?

Respuesta aceptada

Stephen23
Stephen23 el 23 de Feb. de 2015
Editada: Stephen23 el 23 de Feb. de 2015
Can you see netrb listed when you use dir in the command window?
You should read the documentation for exist: it is recommended to use both the input and output specifiers to explicitly define what kind of thing you are checking for. Use this to check for a file:
2==exist(...,'file')
You should also specify the filename complete with file extension, as there could be other similar named functions or variables.
I would also recommend that you use the function syntax of load , like this:
load('netrb')
  3 comentarios
Stephen23
Stephen23 el 23 de Feb. de 2015
My pleasure! Did it help?
Veronika
Veronika el 23 de Feb. de 2015
Yes, it works perfectly.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by