Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
void hormodular::GaitTable::saveToFile ( const std::string  file_path) [private]

Saves the gait table to a Matlab/Octave file.

{
    //-- Open file
    std::ofstream output_file( file_path.c_str() );

    //-- Check file
    if ( output_file.is_open() )
    {
        //-- Print file header:
        output_file << "# Gait Table created by Hormodular [https://github.com/David-Estevez/hormodular.git]"
                 << std::endl;

        output_file << "# name: gaitTable" << std::endl;
        output_file << "# type: matrix" << std::endl;
        output_file << "# rows: " << data.size() << std::endl;
        output_file << "# columns: " << num_parameters+1 << std::endl;

        //-- Print actual data of the gait table
        for ( int i = 0; i < (int)data.size(); i++)
        {
            for ( int j = 0; j < (int)data[i].size() ; j ++)
                output_file << data[i][j] << " ";

            output_file << std::endl;
        }

        output_file.close();
    }
    else
    {
        std::cerr << "[GaitTable] Error: file " << file_path << " could not be opened." << std::endl;
    }
}
 All Classes Functions Variables Friends