|
[/] [trunk/] [lua_to_excel/] [lualist_to_excel.m] - Blame information for rev 8
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
8 |
zonk-5607 |
[filename,filepath]=uigetfile('*.lua'); |
2 |
|
zonk-5607 |
|
3 |
|
zonk-5607 |
|
4 |
|
zonk-5607 |
keywords={'name','prefix','quantity','lvlmin','lvlmax','sellvalue','faction','zone','place','map'}; |
5 |
|
zonk-5607 |
isnumber=[0,0,1,1,1,1,0,0,0,0]; |
6 |
|
zonk-5607 |
|
7 |
|
zonk-5607 |
datafile=fopen([filepath,filename],'r','n','UTF-8'); |
8 |
|
zonk-5607 |
|
9 |
|
zonk-5607 |
tline=fgetl(datafile); |
10 |
|
zonk-5607 |
while(isempty(strfind(tline,'BusyBeeTasks'))) |
11 |
|
zonk-5607 |
tline=fgetl(datafile); |
12 |
|
zonk-5607 |
end |
13 |
|
zonk-5607 |
|
14 |
|
zonk-5607 |
clear cellarray |
15 |
|
zonk-5607 |
for i=1:length(keywords) |
16 |
|
zonk-5607 |
cellarray{1,i}=keywords{i}; |
17 |
|
zonk-5607 |
end |
18 |
|
zonk-5607 |
k=2; |
19 |
|
zonk-5607 |
while(~feof(datafile)) |
20 |
|
zonk-5607 |
tline=fgetl(datafile); |
21 |
|
zonk-5607 |
if ~isempty(strfind(tline,'};')) |
22 |
|
zonk-5607 |
break; |
23 |
|
zonk-5607 |
end |
24 |
|
zonk-5607 |
if size(tline,2)<30 |
25 |
|
zonk-5607 |
continue |
26 |
|
zonk-5607 |
end |
27 |
|
zonk-5607 |
for i=1:length(keywords) |
28 |
|
zonk-5607 |
index=strfind(tline,keywords{i}); |
29 |
|
zonk-5607 |
if(isnumber(i)) |
30 |
|
zonk-5607 |
found1=find((tline(index:end)>='0')&(tline(index:end)<='9')); |
31 |
|
zonk-5607 |
found2=find(tline(index:end)==',',2,'first'); |
32 |
|
zonk-5607 |
string=tline((index+found1-1):(index+found2-2)); |
33 |
|
zonk-5607 |
else |
34 |
|
zonk-5607 |
found=find(tline(index:end)=='"',2,'first'); |
35 |
|
zonk-5607 |
string=tline((index+found(1)):(index+found(2)-2)); |
36 |
|
zonk-5607 |
end |
37 |
|
zonk-5607 |
cellarray(k,i)={string}; |
38 |
|
zonk-5607 |
end |
39 |
|
zonk-5607 |
k=k+1; |
40 |
|
zonk-5607 |
end |
41 |
|
zonk-5607 |
fclose(datafile); |
42 |
|
zonk-5607 |
numlines=k-1; |
43 |
|
zonk-5607 |
|
44 |
|
zonk-5607 |
for i=1:numlines |
45 |
|
zonk-5607 |
cellarray(i,1)={[cellarray{i,2},' ',cellarray{i,1}]}; |
46 |
|
zonk-5607 |
end |
47 |
|
zonk-5607 |
cellarray(:,2)=[]; |
48 |
|
zonk-5607 |
cellarray(1,1)={'name'}; |
49 |
|
zonk-5607 |
|
50 |
|
zonk-5607 |
|
51 |
|
zonk-5607 |
xlsname=[filename(1:(end-4)),'.xls']; |
52 |
|
zonk-5607 |
xlswrite([filepath,xlsname],cellarray) |
53 |
|
zonk-5607 |
|
54 |
|
zonk-5607 |
|
55 |
|
zonk-5607 |
|
All times are GMT -5. The time now is 06:47 AM.
|
|