how to write a .dat file in matlab?

조회 수: 5 (최근 30일)
preet
preet 2013년 4월 17일
i have the 1000 training images and 100 test images. i need to read all and save in the .dat file and use in the vc++. if there is any alternate technique to read the images . please share your ideas with me.
thanks

채택된 답변

Ahmed A. Selman
Ahmed A. Selman 2013년 4월 18일
The obvious method is to construct a loop to read filenames, inside it, open and read, then accumulate the data content in some file you select. You need (maybe) to have a certain way to distinguish between images data if they are to be joined in a single data file, and you must think of such file to be relatively large to handle.
If filenames have some sequence then it is possible to automate the reading loop easily, if not, however, you might consider renaming these image files. Other than this I can't understand a method to read many files with vast differences in their names automatically.
Also, as Walter ans Jan said above, if non of these answer give you an idea about the solution you seek then please elaborate your problem with more details, as filenames to be used in reading, data type you need to store, and the format of how you need to write them..etc.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2013년 4월 17일
.dat includes any binary format. You can use fwrite() to store binary data.
You may need to invent a binary protocol to signal image size and number of bits per pixel.
When you store the images in binary, keep in mind that MATLAB's internal order is "down the columns", whereas C++'s internal order is "across the rows".
  댓글 수: 2
preet
preet 2013년 4월 18일
so what approach should i follow to read image.actually i did not find any code in visual c++ to read all images from a folder or directory so i approached here mean matlab.please help me .
Walter Roberson
Walter Roberson 2013년 4월 18일

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


Jan
Jan 2013년 4월 17일
This is a very general question, which cannot be answered precisely. It is a good strategy to use an established format to store pictures in, while inventing a new .dat format willwaste a lot of time. You are asking for an "alternate technique to read images" - alternate to what?
  댓글 수: 1
preet
preet 2013년 4월 18일
to store the images data in single file like .txt format.

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

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by