Hi,
In the file xls2oct.m from io-10.0.14 there is a problem reading dates with JXL. I have traced a problem to places where strsplit is called with arguments in the wrong order. There is another problem with undefined variable months which I naively defined as {'JAN','FEB',.. } but I suppose a better correction should consider locals. Another problem is a reverse condition of isTime.
I attach my svn diff, can someone look at it and see if it's ok?
Cheers,
Ron

***********************************************************
This outgoing email was scanned for viruses and other malicious content by the IT 
Department of Israel Oceanographic & Limnological Research.
AntiVirus system managed by Eli W. Tel. 972-4-8565267
IMPORTANT: Do not open attachments from unrecognized senders. Never open attached files with extensions: *.pif, *.scr, *.vbs, *.exe.
***********************************************************
Index: io/inst/xls2oct.m
===================================================================
--- io/inst/xls2oct.m	(revision 8199)
+++ io/inst/xls2oct.m	(working copy)
@@ -635,6 +635,7 @@
 	endif
 
 	# Read contents into rawarr
+        months={'JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'};
 	rawarr = cell (nrows, ncols);			# create placeholder
 	for jj = lcol : rcol
 		for ii = firstrow:lastrow
@@ -655,14 +656,14 @@
 						rawarr {ii+1-firstrow, jj+1-lcol} = scell.getValue ();
 					catch
 						% Newer JXL.JAR, returns date string w. epoch = 1-1-1900 :-(
-						tmp = strsplit (' ', char (scell.getDate ()));
+						tmp = strsplit (char (scell.getDate ()), ' ');
 						yy = str2num (tmp{6});
 						mo = find (ismember (months, upper (tmp{2})) == 1);
 						dd = str2num (tmp{3});
 						hh = str2num (tmp{4}(1:2));
 						mi = str2num (tmp{4}(4:5));
 						ss = str2num (tmp{4}(7:8));
-						if (~scell.isTime ())
+						if (scell.isTime ())
 							yy = mo = dd = 0;
 						endif
 						rawarr {ii+1-firstrow, jj+1-lcol} = datenum (yy, mo, dd, hh, mi, ss);
@@ -686,7 +687,7 @@
 						unwind_protect_cleanup
 							if (isempty (rawarr {ii+1-firstrow, jj+1-lcol}))
 								% Newer JXL.JAR, returns date string w. epoch = 1-1-1900 :-(
-								tmp = strsplit (' ', char (scell.getDate ()));
+								tmp = strsplit (char (scell.getDate ()), ' ');
 								yy = str2num (tmp{6});
 								mo = find (ismember (months, upper (tmp{2})) == 1);
 								dd = str2num (tmp{3});

<<attachment: ron.vcf>>

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to