java - Writing number to .mat gives other result than to text file -


i'm measuring runtime of system arraylist<long> runtime. different entries of list i'm getting through system.nanotime(); returns long.

i'm writing arraylist text file looping on list , using long.tostring(); each entry.

so far good, create .mat file jmatio (matlab file format). in following way (remember arraylist<long> runtime):

// convert arraylist array because jmatio accepts arrays long[] runtimearr = new long[runtime.size()]; int = 0; (long : runtime) {    runtimearr[i] = a;    i++; }  // write .mat file. arraylist<mlarray> list = new arraylist<mlarray>(); mlint64 m = new mlint64("runtime", runtimearr, 1); list.add(m); new matfilewriter("runtime.mat", list); // creates .mat 

if open .mat file in matlab displayed numbers different in text file (i'm using format long g in matlab). example in matlab i'm getting 1988336630 , in text file 1993496993.

why this?

edit: here complete example

public class main {   public static void main(string[] args) {      arraylist<long> runtime = new arraylist<long>();      thread.sleep(2000);      runtime.add(system.nanotime());      file file = new file("filename.txt");      filewriter fw = new filewriter(file.getabsolutefile());      bufferedwriter bw = new bufferedwriter(fw);      bw.write(long.tostring(runtime.get(0)));      bw.close();        // convert arraylist array because jmatio accepts arrays      long[] runtimearr = new long[runtime.size()];      int = 0;      (long : runtime) {         runtimearr[i] = a;         i++;      }       // write .mat file.      arraylist<mlarray> list = new arraylist<mlarray>();      mlint64 m = new mlint64("runtime", runtimearr, 1);      list.add(m);      new matfilewriter("runtime.mat", list); // creates .mat   } } 


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -