Main MRPT website > C++ reference for MRPT 1.9.9
Functions
Load and save vectors to files (in #include

Detailed Description

<mrpt/io/vector_loadsave.h>)

<mrpt/system/vector_loadsave.h>)

Functions

bool mrpt::io::vectorToBinaryFile (const std::vector< uint8_t > &vec, const std::string &fileName)
 Saves a vector directly as a binary dump to a file: More...
 
bool mrpt::io::loadBinaryFile (std::vector< uint8_t > &out_data, const std::string &fileName)
 Loads a entire file as a vector of bytes. More...
 
bool mrpt::io::loadTextFile (std::vector< std::string > &o, const std::string &fileName)
 Loads a text file as a vector of string lines. More...
 
bool mrpt::system::vectorToTextFile (const std::vector< float > &vec, const std::string &fileName, bool append=false, bool byRows=false)
 A useful function for debugging, which saves a std::vector into a text file (compat. More...
 
bool mrpt::system::vectorToTextFile (const std::vector< double > &vec, const std::string &fileName, bool append=false, bool byRows=false)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
bool mrpt::system::vectorToTextFile (const std::vector< int > &vec, const std::string &fileName, bool append=false, bool byRows=false)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
bool mrpt::system::vectorToTextFile (const std::vector< size_t > &vec, const std::string &fileName, bool append=false, bool byRows=false)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<class EIGEN_MATRIX >
bool mrpt::system::vectorToTextFile (const EIGEN_MATRIX &vec, const std::string &fileName)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
bool mrpt::system::vectorFromTextFile (std::vector< double > &vec, const std::string &fileName, const bool byRows=false)
 Load a std::vector from a text file (compat. More...
 

Function Documentation

◆ loadBinaryFile()

bool mrpt::io::loadBinaryFile ( std::vector< uint8_t > &  out_data,
const std::string fileName 
)

Loads a entire file as a vector of bytes.

Returns
Returns false on any error, true on everything OK.
See also
vectorToBinaryFile

Definition at line 20 of file system/src/vector_loadsave.cpp.

References mrpt::system::os::fclose(), mrpt::system::os::fopen(), and mrpt::system::os::fprintf().

◆ loadTextFile()

bool mrpt::io::loadTextFile ( std::vector< std::string > &  o,
const std::string fileName 
)

Loads a text file as a vector of string lines.

Returns
Returns false on any error, true on everything OK.

Definition at line 58 of file system/src/vector_loadsave.cpp.

◆ vectorFromTextFile()

bool mrpt::system::vectorFromTextFile ( std::vector< double > &  vec,
const std::string fileName,
const bool  byRows = false 
)

Load a std::vector from a text file (compat.

with MATLAB)

Returns
Returns false on any error, true on everything OK.
See also
loadBinaryFile

Definition at line 79 of file system/src/vector_loadsave.cpp.

References mrpt::system::os::fopen().

◆ vectorToBinaryFile()

bool mrpt::io::vectorToBinaryFile ( const std::vector< uint8_t > &  vec,
const std::string fileName 
)

Saves a vector directly as a binary dump to a file:

Returns
Returns false on any error, true on everything OK.
See also
loadBinaryFile

Definition at line 43 of file system/src/vector_loadsave.cpp.

Referenced by mrpt::io::zip::decompress_gz_data_block().

◆ vectorToTextFile() [1/5]

template<class EIGEN_MATRIX >
bool mrpt::system::vectorToTextFile ( const EIGEN_MATRIX &  vec,
const std::string fileName 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 44 of file system/include/mrpt/system/vector_loadsave.h.

◆ vectorToTextFile() [2/5]

bool mrpt::system::vectorToTextFile ( const std::vector< double > &  vec,
const std::string fileName,
bool  append = false,
bool  byRows = false 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 34 of file system/src/vector_loadsave.cpp.

References mrpt::system::os::fopen(), and mrpt::system::os::fprintf().

◆ vectorToTextFile() [3/5]

bool mrpt::system::vectorToTextFile ( const std::vector< float > &  vec,
const std::string fileName,
bool  append = false,
bool  byRows = false 
)

A useful function for debugging, which saves a std::vector into a text file (compat.

with MATLAB)

Returns
Returns false on any error, true on everything OK.

Definition at line 19 of file system/src/vector_loadsave.cpp.

Referenced by mrpt::bayes::CKalmanFilterCapable< 7, 3, 3, 7 >::runOneKalmanIteration().

◆ vectorToTextFile() [4/5]

bool mrpt::system::vectorToTextFile ( const std::vector< int > &  vec,
const std::string fileName,
bool  append = false,
bool  byRows = false 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 49 of file system/src/vector_loadsave.cpp.

References mrpt::system::os::fopen(), and mrpt::system::os::fprintf().

◆ vectorToTextFile() [5/5]

bool mrpt::system::vectorToTextFile ( const std::vector< size_t > &  vec,
const std::string fileName,
bool  append = false,
bool  byRows = false 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 64 of file system/src/vector_loadsave.cpp.

References mrpt::system::os::fclose(), mrpt::system::os::fopen(), and mrpt::system::os::fprintf().




Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST