You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: train_svm_PCA.m
    path of file: ./repos/HOG-Pedestrian-Detector
    
    the code of the file until where you have to start completion: function [new_model,Ureduce] = train_svm_PCA(model_name, paths)
% TRAIN_SVM_PCA Train an SVM classifier with the specified images.
%           Performing a cross-validation to find the best params.
%
% Asumming pedestrian label as 1.0 and not pedestrian as -1.0
% (Code using libsvm)
%
% INPUT:
% Paths: positive / negative images_path: paths of the images to train
% model_name: name for saving the SVM model
%
% OUTPUT: libSVM model and reduced singular vector matrix.
%
%$ Author Jose Marcos Rodriguez $    
%$ Date: 2014/03/11 $    
%$ Revision: 1.2 $


    %% path stuff
    if nargin < 2
        model_save_path = uigetdir('.models','Select model save folder');
        positive_images_path = uigetdir('.images','Select positive image folder');
        negative_images_path = uigetdir('.images','Select negative image folder');
        
        if isa(model_save_path,'double')  || ...
           isa(positive_images_path,'double')  || ...

    
function [new_model,Ureduce] = train_svm_PCA(model_name, paths)
% TRAIN_SVM_PCA Train an SVM classifier with the specified images.
%           Performing a cross-validation to find the best params.
%
% Asumming pedestrian label as 1.0 and not pedestrian as -1.0
% (Code using libsvm)
%
% INPUT:
% Paths: positive / negative images_path: paths of the images to train
% model_name: name for saving the SVM model
%
% OUTPUT: libSVM model and reduced singular vector matrix.
%
%$ Author Jose Marcos Rodriguez $    
%$ Date: 2014/03/11 $    
%$ Revision: 1.2 $


    %% path stuff
    if nargin < 2
        model_save_path = uigetdir('.models','Select model save folder');
        positive_images_path = uigetdir('.images','Select positive image folder');
        negative_images_path = uigetdir('.images','Select negative image folder');
        
        if isa(model_save_path,'double')  || ...
           isa(positive_images_path,'double')  || ...
           isa(negative_images_path,'double')
            cprintf('Errors','Invalid paths...\nexiting...\n\n')
            return 
        end