Contents Previous Next Subchapters

Reading and Writing to Network Folders
See Also h5read , read , write , and urlget

Description
The input and output routines in O-Matrix support reading and writing to local network shares and extranet folders such as WebDAV servers. This provides a convenient method for centrally locating your data. Other O-Matrix users can run your applications without copying your data to their local machine and you can easily load centrally located data without copying it to your local machine.

Examples

Data IO on a Network Share
This example creates the file rand.txt on the network share \\Harmonic\temp, (You will need to edit the value of shareFolder in the example to a value that is a valid shared directory on your local network). If at the O-Matrix command line prompt you enter
     clear
     const shareFolder = "\\Harmonic\temp\"
     fileName = [shareFolder,"rand.txt"]
     data = rand(10 , 15)
     write(fileName, data)
     close(fileName)
O-Matrix will create the file rand.txt in the \temp folder on the machine Harmonic. Selecting My Network Places in Windows explorer you can browse to this machine and directory to verify that the file was created. If you continue the example by entering
     data = read(fileName,"double", 10, 15)
     data(1,1)
O-Matrix will respond
     0.253719 

Data IO to a WebDAV Folder
WebDAV is an Internet file access protocol. Windows XP includes WebDAV support which enables you to access servers on the Internet just as you would a file or server share. The MSN Communities and XDrive servers support this protocol for public access. The following example reads and displays the README.TXT file stored in the OMatrix folder on the MSN Communities server.
     clear
     const webFolder = "\\www.msnusers.com\OMatrix\Documents\"
     fileName = [webFolder,"README.TXT"]
     Nr = nrows(fileName)
     read(fileName, "char", Nr, 60)
     close(fileName)
O-Matrix will respond

                                                            
This folder is intended for storage of O-Matrix related     
documents, utilities, and applications.  Users interested   
in participating in the O-Matrix news group should visit    
http://groups.yahoo.com/group/omatrix/                      
                                                            
(Note that the first operation on a WebDAV server may be slow but subsequent operations generally run quickly) You can also directly write to a WebDAV folder. If you continue the example above by entering
     fileName = [webFolder,"TEST.TXT"]
     for i = 1 to 3 begin
          write( fileName, seq(4)*i )
     end
     close
O-Matrix will create the file TEST.TXT on the server. Using Internet Explorer you can browser to the server directory to verify the contents of the file.