Convert .MAT to .DAT in matlab for a 2D Image
5 views (last 30 days)
Show older comments
Fakiha Akbar
on 29 Jul 2015
Commented: Fakiha Akbar
on 31 Jul 2015
Hi,
I've been trying to convert .Mat files to .Dat file in MATLAB. Actually the codes takes .Dat file of an image and then denoises it.
I have .MAT MRI images and I'm unable to convert it into .DAT
Is there any way of changing the code if the first option isn't feasible?
Thanks for the response x
4 Comments
Walter Roberson
on 29 Jul 2015
What existing code is it that takes a .dat file extension?
Because .dat files can be anything, we need to know what format the existing code expects. In particular we need to know how the code expects the size information to be represented, and we need to know whether the code expects data to be stored "across" or "down" matrices, and we need to know how it wants the color planes to be interleaved if it supports color planes.
See also http://uk.mathworks.com/matlabcentral/answers/231355-how-to-create-a-dat-file-for-a-satellite-image in which someone thought they needed .dat but they do not.
Accepted Answer
Walter Roberson
on 30 Jul 2015
matname = [dataset '.mat'];
datastruct = load(matname);
fn = fieldnames(datastruct);
outname = [dataset '.dat'];
data_to_save = datastruct.(fn{1});
save(outname, 'data_to_save', '-ASCII');
More Answers (0)
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!