lotrointerface.com
Search Downloads

LoTROInterface SVN BusyBeeTasks

[/] [trunk/] [lua_to_excel/] [excel_to_lualist.m] - Blame information for rev 36

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 zonk-5607
[xlsname,filepath]=uigetfile('*.xls');
2 zonk-5607
 
3 zonk-5607
[num,txt,raw]=xlsread([filepath,xlsname]);
4 zonk-5607
clear num txt
5 zonk-5607
 
6 36 zonk-5607
%old version with separate prefix/name
7 zonk-5607
%keywords={'name','prefix','quantity','lvlmin','lvlmax','sellvalue','faction','zone','place','map'};
8 zonk-5607
%isnumber=[0,0,1,1,1,1,0,0,0,0];
9 zonk-5607
%skiplist=[];
10 zonk-5607
 
11 zonk-5607
%new version, only name is relevant
12 zonk-5607
keywords={'','name','qty','lvl','','','faction','zone','place',''};
13 8 zonk-5607
isnumber=[0,0,1,1,1,1,0,0,0,0];
14 36 zonk-5607
skiplist=[1,5,6,10];
15 8 zonk-5607
 
16 zonk-5607
expandedarray(1:size(raw,1),2:(size(raw,2)+1))=raw;
17 zonk-5607
numlines=size(raw,1);
18 zonk-5607
 
19 36 zonk-5607
%separate names in prefix and name (old version only)
20 zonk-5607
% for i=1:numlines
21 zonk-5607
%     string=raw{i,1};
22 zonk-5607
%     found=find(isspace(string),1,'last');
23 zonk-5607
%     if isempty(found)
24 zonk-5607
%         string1='';
25 zonk-5607
%         string2=string;
26 zonk-5607
%     else
27 zonk-5607
%         string1=string(1:(found-1));
28 zonk-5607
%         string2=string((found+1):end);
29 zonk-5607
%     end
30 zonk-5607
%     expandedarray(i,1)={string2}; %prefix
31 zonk-5607
%     expandedarray(i,2)={string1}; %name
32 zonk-5607
% end
33 zonk-5607
 
34 zonk-5607
%remove header
35 8 zonk-5607
expandedarray(1,:)=[];
36 zonk-5607
 
37 zonk-5607
filename=[xlsname(1:(end-4)),'_exported.lua'];
38 zonk-5607
 
39 zonk-5607
fid=fopen([filepath,filename],'w','n','UTF-8');
40 zonk-5607
 
41 zonk-5607
fprintf(fid,'BusyBeeTasks = {\n');
42 zonk-5607
 
43 zonk-5607
for i=1:(numlines-1)
44 zonk-5607
    fprintf(fid,'    ');
45 36 zonk-5607
    %fprintf(fid,'[%i] = {id = %i,',i,i);
46 zonk-5607
    fprintf(fid,'{id = %i,',i);
47 8 zonk-5607
 
48 zonk-5607
    for k=1:10
49 36 zonk-5607
        if ~isempty(find(skiplist==k,1))
50 zonk-5607
            continue
51 zonk-5607
        end
52 8 zonk-5607
        if isnumber(k)
53 zonk-5607
            fprintf(fid,[' ',keywords{k},' = ',num2str(expandedarray{i,k}),',']);
54 zonk-5607
        else
55 zonk-5607
            fprintf(fid,[' ',keywords{k},' = "',expandedarray{i,k},'",']);
56 zonk-5607
        end
57 zonk-5607
    end
58 zonk-5607
    fprintf(fid,' },\n');
59 zonk-5607
end
60 zonk-5607
fprintf(fid,'};\n');
61 zonk-5607
 
62 zonk-5607
fclose(fid);

All times are GMT -5. The time now is 07:42 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui