Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the limitations of the Matlab fileread command in -nodesktop mode?

Tags:

file-io

matlab

Assuming a text file with 7718 characters (e.g. the contents cut and pasted from here)

The command fileread('myfile.txt') fails when I launch matlab with matlab -nodesktop but works in desktop mode.

Does anyone have any idea why?

If the number of characters in the text file is reduced to 1981 it works in -nodesktop mode.

Note:I do not know the exact number of characters at which it stops working.

Finally, I am using Matlab 7.8.0 (R2009a) on Windows7.

like image 672
atomh33ls Avatar asked Jan 09 '13 11:01

atomh33ls


People also ask

How do I use Textread in MATLAB?

= textread('filename','format') reads data from the file 'filename' into the variables A,B,C, and so on, using the specified format , until the entire file is read. textread is useful for reading text files with a known format. Both fixed and free format files can be handled.

Can MATLAB open binary files?

A = fread( fileID ) reads data from an open binary file into column vector A and positions the file pointer at the end-of-file marker. The binary file is indicated by the file identifier, fileID . Use fopen to open the file and obtain the fileID value.

How do I read a .data file in MATLAB?

Use fopen to open the file, specify the character encoding, and obtain the fileID value. When you finish reading, close the file by calling fclose(fileID) . A = fscanf( fileID , formatSpec , sizeA ) reads file data into an array, A , with dimensions, sizeA , and positions the file pointer after the last value read.

How much data can MATLAB handle?

Memory Enhancements for Windows XP Also, on Windows XP, MATLAB now supports the 3GB switch boot option, allocating an additional 1 GB of addressable memory to each process. This increases the total amount of data you can store in the MATLAB workspace to approximately 2.7 GB.


1 Answers

I can't reproduce this odd behaviour (Matlab 2010b & 2012b, both on Linux).

You could at least try to "debug" this type of behaviour by restricting the problem. The "fileread" routine does some checks on the file name (ischar, isempty), then opens the file (fopen), reads it (fread) and closes it (fclose) - rather simple basic stuff. For reference, type "edit fileread" into the command line of the matlab desktop and try running down the routine step by step.

If "fread" causes the whole thing to crash and if you're bound to this version of Matlab, try implementing a "fix". "fread" accepts a few more parameters than what is used in "fileread" (the file ID and the precision "char" only): FREAD(FID,SIZE,PRECISION,SKIP,MACHINEFORMAT). Specifying more parameters may help (wild guess but worth a try).

like image 170
s-m-e Avatar answered Nov 15 '22 04:11

s-m-e