Converting .dat to .mat?

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)?

댓글 수: 5

Image Analyst
Image Analyst 2013년 5월 17일
Which part is hanging: the textread(), or the save()?
Rhai
Rhai 2013년 5월 18일
textread('cube.dat')
Rhai
Rhai 2013년 5월 18일
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
for j= 1:yl
for i= 1:xl
%fprintf(fid,'%d %d %d %f %f\n',i,j,k,1);
cube(i,j,k)=1;
end
end
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
Walter Roberson
Walter Roberson 2013년 5월 18일
Your code is not writing anything to cube.dat .

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

질문:

2013년 5월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by