get_new_model_name.m

来自「一个学习自然场景类别的贝叶斯模型、基于“词袋”模型的目标分类。来源于Feifei」· M 代码 · 共 22 行

M
22
字号
function [fname,num] = get_new_model_name(model_dir,num_zeros)

%% little function to return filename for new model, along with its index
%% it sees how many existing models are in model_dir and generates a
%% filename for a new one.

%% input - model_dir, the full path to the model directory.

%% output - fname, full path and file name of new model
%%          num, index of new model

%%% what is the model filename prefix
model_prefix = 'model_';

%%% get list of all existing models in directory
d = dir([model_dir,'/*.mat']);

%%% get index of new model (+1 from last)
num = length(d)+1;

%%% create filename
fname = [model_dir,'/',model_prefix,prefZeros(num,num_zeros),'.mat'];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?