MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Rhai
on 17 May 2013

I have cube.dat file with dimensions 59X44X76. i am trying to convert it into .mat file with same dimensions. I tried following code, once i run the code it never stops

Option1:

data=textread('cube.dat'); save data.mat;

Option 2

data=textread('cube.dat'); save data.mat data;

Those both codes are running forever. Is there somehting am i missing (like format or anything)?

*No products are associated with this question.*

## 5 Comments

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76211#comment_149583

Which part is hanging: the textread(), or the save()?

## Rhai (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76211#comment_149680

## Rhai (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76211#comment_149681

here is the code which creates "Cube.dat" is 128x128x8

clear all;close all; xl=58 yl=44 zl=76

fid=fopen('cube.dat','w')

for k=1:zl

end

And i need to create cube with 58x44x76.that's where i used above code

data=textread('cube.dat'); save data.mat data;

And its getting hang in "data=textread('cube.dat'); "

Thanks

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76211#comment_149685

Where did you upload cube.dat? http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76211#comment_149695

Your code is not writing anything to cube.dat .