Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Stephen23
Stephen23 am 23 Feb. 2015
Bearbeitet: Stephen23 am 23 Feb. 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 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by