mardi 26 mai 2015

Last elseif statement does not exicute

My last elseif statement does not execute even if the conditions are met:

Currency_Exchanage != 'Select...' and all other variables (ETF_Exchanage, Index_Exchanage and Stock_Exchanage) = 'Select...'

Here is the section of code that I am concerned about:

if (strcmp(ETF_Exchanage,'Select...') == 1) && (strcmp(Stock_Exchanage,'Select...') == 1) && (strcmp(Index_Exchanage,'Select...') == 1)...
        (strcmp(Currency_Exchanage,'Select...') == 1)
    if db == 1 && uni == 1
        tickers = gnr_bloomberg; % Analsise Bloomberg natural resources
        nrm=1;
    elseif db == 1 && uni == 2
        tickers = all_bloomberg; % Analsise Bloomberg all
        nrm=1;
    elseif db == 2 && uni == 1
        tickers = gnr_yahoo;     % Analsise Yahoo natural resources
        nrm=1;
    elseif db == 2 && uni == 2
        tickers = all_yahoo;     % Analsise Yahoo all
        nrm=1;
    end
else
    %Yahoo inputs
    if (strcmp(ETF_Exchanage,'Select...') == 0) && (strcmp(Stock_Exchanage,'Select...') == 1) && (strcmp(Index_Exchanage,'Select...') == 1)...
            (strcmp(Currency_Exchanage,'Select...') == 1); %Choose exhanges from ETF
        tickers = ETF_Yahoo(:,1);
        Exchanges = ETF_Yahoo(:,2);
        Exchange = ETF_Exchanage;
        db=2; %Yahoo Selection

    elseif (strcmp(Index_Exchanage,'Select...') == 0) && (strcmp(Stock_Exchanage,'Select...') == 1) && (strcmp(ETF_Exchanage,'Select...') == 1)...
            (strcmp(Currency_Exchanage,'Select...') == 1); %Choose exhanges from Index
        tickers = Index_Yahoo(:,1);
        Exchanges = Index_Yahoo(:,2);
        Exchange = Index_Exchanage;
        db=2;

    elseif (strcmp(Stock_Exchanage,'Select...') == 0) && (strcmp(ETF_Exchanage,'Select...') == 1) && (strcmp(Index_Exchanage,'Select...') == 1)...
            (strcmp(Currency_Exchanage,'Select...') == 1); %Choose exhanges from Stock
        tickers = Stock_Yahoo(:,1);
        Exchanges = Stock_Yahoo(:,2);
        Exchange = Stock_Exchanage;
        db=2;

    elseif (strcmp(Currency_Exchanage,'Select...') == 0) && (strcmp(Stock_Exchanage,'Select...') == 1) && (strcmp(Index_Exchanage,'Select...') == 1)...
            (strcmp(ETF_Exchanage,'Select...') == 1); %Choose exhanges from Currency
        tickers = Currency_Yahoo(:,1);
        Exchanges = Currency_Yahoo(:,2);
        Exchange = Currency_Exchanage;
        db=2;
    else
        msg = 'Error occurred.\Only one Yahoo input menue must be used!';
        error(msg)
    end
end

Any Help would be much appropriated, I can't see where I'm going wrong here. I am using Matlab 2013a.

Aucun commentaire:

Enregistrer un commentaire