On Aug 17, 9:15 am, "Alex " <blue.harvest...@gmail.com> wrote: > I have been looking around the newsreader as well as other search engines for an answer to a problem I'm having, but haven't had any luck. > I have a camera that records data as a .sif file, and exports it as a .dat file. The video has a resolution of 512x512, is 600 frames in length, and the file size is 300MB. It may be exporting the video as a 307200x514 array (it adds a column of padding to both sides of the array, and stacks the frames together as rows ), but I'm not sure as I cant get the file open. It should be a space delimited file containing only numbers representing intensities on the camera, no text. My question is how to read the .dat file into matlab as an array. > I have tried: > > A = fread('new02z.dat') > A = fopen('new02z.dat'); > A = fopen('new02z.dat','r') > fid = ('new02z.dat') > A = fread(fid, [307200,514]); > A = textread('new02z.dat'); > A = dlmread('new02z.dat',' '); > A = dlmread('new02z.dat',' ',0,0); > and the import data wizard. > > all either imported a single digit, or returned error messages to which I have not found a solution for. > I am running 7.11.0 R2010b if that helps. > > Thanks, > Alex
Unless you find out for sure what the format is, you've got no hope. This " It may be exporting the video as a 307200x514 array" is not good enough. And what is "a column of padding"? Is it an extra comma at the front and end of each line? Or what?
One way to check all this is: fid =fopen('new02z.dat','rt'); line=fgetl(fid) This will give you the first line in the file and from that you can figure out what to do next.
Here's a guess at what you need frewind(fid); % Need to rewind after fgetl c=textscan(fid,repmat('%f',514,1),20); which will read the first 20 lines, assuming the delimiter is space.