No BSD License  

Highlights from
Quran Comparison & Search-requires Matlab

image thumbnail
from Quran Comparison & Search-requires Matlab by Aman Siddiqi
Compares 10 translation of the quran with search

retrieve.m
%[numberspq, pq] = xlsread('Parallel_Quran.xls');
opening; safetycheck;
if safetyvalue==1;

if get(findobj('Tag','khanbox'), 'value')==1; if exist('translations'); translations(end+1)=1; else; translations = 1; end; end;
if get(findobj('Tag','maulanabox'), 'value')==1; if exist('translations'); translations(end+1)=2; else; translations = 2; end; end;
if get(findobj('Tag','pickthalbox'), 'value')==1; if exist('translations'); translations(end+1)=3; else; translations = 3; end; end;
if get(findobj('Tag','rashadbox'), 'value')==1; if exist('translations'); translations(end+1)=4; else; translations = 4; end; end;
if get(findobj('Tag','sarwarbox'), 'value')==1; if exist('translations'); translations(end+1)=5; else; translations = 5; end; end;
if get(findobj('Tag','shakirbox'), 'value')==1; if exist('translations'); translations(end+1)=6; else; translations = 6; end; end;
if get(findobj('Tag','sheralibox'), 'value')==1; if exist('translations'); translations(end+1)=7; else; translations = 7; end; end;
if get(findobj('Tag','yusufalibox'), 'value')==1; if exist('translations'); translations(end+1)=8; else; translations = 8; end; end;
if get(findobj('Tag','ahmedalibox'), 'value')==1; if exist('translations'); translations(end+1)=9; else; translations = 9; end; end;
if get(findobj('Tag','salebox'), 'value')==1; if exist('translations'); translations(end+1)=10; else; translations = 10; end; end;

if retrievevalue==1; 
    section_length=length((ayatlist(from_surah,2)+from_ayah):(ayatlist(to_surah,2)+to_ayah));
    removematrix=zeros(section_length,10); end;
if get(findobj('Tag','wraptextbox'), 'value')==1; set(findobj('Tag','displaybox'), 'Style', 'edit'); else; set(findobj('Tag','displaybox'), 'Style', 'listbox'); end;

if searching==0;  %regular retrieve
    verselist=(ayatlist(from_surah,2)+from_ayah):(ayatlist(to_surah,2)+to_ayah); %cumulative verse number
else; %Search query
    verselist=foundresults1;
end;

for master_verse1=1:length(verselist);
    master_verse=verselist(master_verse1);
    if exist('translations');
        for indx=1:length(translations);
            current_row=(((master_verse-1)*10)+translations(indx)); %calculates row in paralell quran to extract for each translation selected
            if removing==1 & removematrix(master_verse1,translations(indx))~=0;
                pastedatatemp=str2cellmatrix(pq{current_row});
                if 1+removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,translations(indx))<1; removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,translations(indx))=0; end;
                if 1+removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,translations(indx))>length(pastedatatemp); removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,translations(indx))=length(pastedatatemp)-1; end;
                switch translations(indx); case 1; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,1); case 2; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,2); case 3; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,3);  case 4; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,4); case 5; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,5); case 6; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,6); case 7; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,7); case 8; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,8); case 9; removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,9); case 10;removevalue=removematrix(master_verse-(ayatlist(to_surah,2)+to_ayah)+section_length,10); end;
                pastedatatemp=pastedatatemp(1+removevalue:end);
                pastedata=cellmatrix2str(pastedatatemp,1);
            else; pastedata=pq(current_row);
            end;  
            if get(findobj('Tag','labelsbox'), 'value')==1; % calculates & concatenates curren Surah & verse numbers
                temp1=find((ayatlist(:,2)>=master_verse)<1);
                current_surah=temp1(end);
                current_ayat=master_verse-ayatlist(current_surah,2);
                switch translations(indx); case 1; paste_text1={['Khan         ']}; case 2; paste_text1={['Maulana    ']}; case 3; paste_text1={['Pickthal    ']}; case 4; paste_text1={['Rashad     ']}; case 5; paste_text1={['Sarwar      ']}; case 6; paste_text1={['Shakir       ']}; case 7; paste_text1={['Sherali      ']}; case 8; paste_text1={['Yusuf Ali   ']}; case 9; paste_text1={['Ahmed Ali ']}; case 10;paste_text1={['G. Sale     ']}; end;
                paste_text2={[num2str(current_surah),':',num2str(current_ayat),' ']};
                paste_text3=pastedata;
                paste_text= {[paste_text1{1} paste_text2{1} paste_text3{1}]};
            else; paste_text=pastedata; end;
            if exist('valuesdisplay');
                valuesdisplay(end+1) = paste_text;
            else; valuesdisplay = paste_text; end;
        end;
    end;
    if get(findobj('Tag','spacebox'), 'value')==1;
        if exist('valuesdisplay'); valuesdisplay(end+1) = {[]}; end;
    end;
end;

if exist('valuesdisplay');
     set(findobj('Tag','displaybox'), 'string', valuesdisplay) %inputs trnaslations into Display Box
end;
end;

Contact us at files@mathworks.com