This is a script to read three set of values (x,y,z) from a file named scilabtest1.txt and plot it using plot3d1 function.This is my first experience with Scilab hope to learn more soon

The data file i used is here scilabtest1.txt put this in the same directory
The full code is here download as a file scilab1.sce


 //************************
 //Scilab:--File Operations
 //************************

 //Main Program

 //Opening A file for reading.

 filename= 'scilabtest1.txt';

 fid = mopen(filename, "r");
 //fid=file descriptor r =>in reading mode

  if (fid == -1)
    error("cannot open file for reading");
  end

  mprintf('value of fid is %f \n', fid);

 //------------------------------
  //reading data Method 1 using While loop

  //done_yet=0;

  //while (done_yet == 0)

    //[num_read, val(1), val(2), val(3), val(4)] = mfscanf(fid, "%f %f %f %f");

     //mprintf('value of num_read is %f \n', num_read);
    // num_read =-1 if there is no more lines to read

     //if (num_read <= 0)
     //done_yet = 1;
     //end

  //end
//--------------------------------

//reading Data using Method 2 For Loop
for i=1:6
  [num_read,x(i),y(i),z(i)]=mfscanf(fid,'%f\t%f\t%f');

    mprintf('value of num_read is %f \n', num_read);
    // num_read =-1 if there is no more lines to read
end

//print the read two values to Scilab window

  X=[x(1) x(2) x(3)];

  mprintf('x values are %f \t  %f \n',X ); 

  Y=[y(1) y(2) y(3)];

  mprintf('y values are %f \t  %f \n',Y );

  Z=[z(1) z(2) z(3)];

  mprintf('z values are %f \t  %f \n',Z ); 

//---------------------------------------

plot3d1(X ,Y,Z)

  mclose(fid);

 //To Avoid restarting of scilab due to errors occurred
 //in between opening and closing of files
 //from http://home.iitk.ac.in/~swagatk/faq/scilab/scilab_general.html

 file('close',file());
 //Closes all open files
 //-------------------------------------

//str='bber'
//int= 23
//mfprintf(fid, 'string %s and integer %d\n', str, int)
//colors=['red';'green';'blue';'pink';'black'];
//RGB=[1 0 0;0 1 0;0 0 1;1 0.75 0.75;0 0 0];
//mprintf('%d\t%s\t%f\t%f\t%f\n',(1:5)',colors,RGB)
//mclose( )