網頁

2011年8月25日 星期四

Change the optimization option to disable when starting Modelsim


Find the modelsim.ini file in the install path, and Change "VoptFlow" parameter to false in the file.

[vsim]
; vopt flow
; Set to turn on automatic optimization of a design.
; Default is on
VoptFlow = 0

2011年6月1日 星期三

MATLAB save neural network object to file

it is a easy operation that saves the neural network object to MAT-file in the MATLAB, but the problem is how to load the neural network object from MAT-file.

save the neural network object
    save('./dat/bpnn_00.mat', 'bpnn'); 
    %    | file name      |  nn obj | // it`s easy.

load the neural network object
    newData1 = load('-mat', './dat/bpnn_00.mat');
    
    % transfer variable format
    vars = fieldnames(newData1);
    for i = 1:length(vars)
        assignin('base', vars{i}, newData1.(vars{i}));
    end

MATLAB get 'bpnn' of the neural network object, but the neural network can`t simulate. I don`t know why the neural network object can`t directly simulate.
    nnResult = sim(bpnn, nnInput); % nnResult is error value

I add a 'getx' function to program, and 'nnResult' of the neural network is correct value. Why?
    nnWB = getx(bpnn); % <-- why? 
    nnResult = sim(bpnn, nnInput); % nnResult is correct value

It maybe the weight and bias value don`t put to the variable of the neural network tool when MATLAB load the MAT-file.