Path: news.mathworks.com!not-for-mail
From: "Guan Hong " <jail_mage86@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Error Message "Subscripted assignment dimension mismatch"
Date: Fri, 23 Mar 2012 06:26:22 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <jkh52e$ko5$1@newscl01ah.mathworks.com>
Reply-To: "Guan Hong " <jail_mage86@hotmail.com>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1332483982 21253 172.30.248.48 (23 Mar 2012 06:26:22 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 23 Mar 2012 06:26:22 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3397223
Xref: news.mathworks.com comp.soft-sys.matlab:761909

Hi, I have encountered an error message "Subscripted assignment dimension mismatch" while running the m-file below. I would like to seek your expertise as I am new to MatLab. Your help will be greatly appreciated.

%---------Pairwise Comparison: Eigenvector Method-------------
disp('----Pairwise Comparison: Eigenvector Method----')
PM =[1/1 4/1 8/7 8/3 8/7 1/1 8/5 8/1 4/3 4/3;
    1/4 1/1 2/7 2/3 2/7 1/4 2/5 2/1 1/3 1/3;
    7/8 7/2 1/1 7/3 1/1 7/8 7/5 7/1 7/6 7/6;
    3/8 3/2 3/7 1/1 3/7 3/8 3/5 3/1 1/2 1/2;
    7/8 7/2 1/1 7/3 1/1 7/8 7/5 7/1 7/6 7/6;
    1/1 4/1 8/7 8/3 8/7 1/1 8/5 8/1 4/3 4/3;
    5/8 5/2 5/7 5/3 5/7 5/8 1/1 5/1 5/6 5/6;
    1/8 1/2 1/7 1/3 1/7 1/8 1/5 1/1 1/6 1/6;
    3/4 3/1 6/7 2/1 6/7 3/4 6/5 6/1 1/1 1/1;
    3/4 3/1 6/7 2/1 6/7 3/4 6/5 6/1 1/1 1/1]
Wt(:,1)=[1;0;0;0;0;0;0;0;0;0]
[len,width]=size(PM); %3 x 3 matrix
delta(:,1)=[1 1 1 1 1 1 1 1 1 1]';
trial=100;


for t=2:trial
    Wt1(:,t)=PM*Wt(:,t-1);
    max_eig=sum(Wt1(:,t));
    Wtnorm1(:,t)=Wt1(:,t)./max_eig;
    delta(:,t-1)=abs(Wt(:,t-1)-Wtnorm1(:,t));
    if delta(:,t-1)>=1e-6
        Wt(:,t)=Wtnorm1(:,t);
    else
        CI=(max_eig-width)/(width-1);
        weight=Wtnorm1;
        break
    end
end
final_weight=weight(:,length(weight))
disp(['After ', num2str(t),' iterations.........'])
disp(['The pairwise comparison result is [',num2str(final_weight(1)),' ', num2str(final_weight(2)),' ', num2str(final_weight(3)),' ', num2str(final_weight(4)),' ', num2str(final_weight(5)),' ', num2str(final_weight(6)),' ', num2str(final_weight(7)),' ', num2str(final_weight(8)),' ', num2str(final_weight(9)),' ', num2str(final_weight(10)),']' ])