// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_MATLAB_FORMAT_H #define IGL_MATLAB_FORMAT_H #include "igl_inline.h" #include #include #include namespace igl { // This is a routine to print a matrix using format suitable for pasting into // the matlab IDE // // Templates: // DerivedM e.g. derived from MatrixXd // Input: // input some matrix to be formatted // name name of matrix // Returns Formatted matrix // // Example: // // M := [1 2 3;4 5 6]; // cout< IGL_INLINE const Eigen::WithFormat< DerivedM > matlab_format( const Eigen::DenseBase & M, const std::string name = ""); // Same but for sparse matrices. Print IJV format into an auxiliary variable // and then print a call to sparse which will construct the sparse matrix // Example: // // S := [0 2 3;4 5 0]; // cout< IGL_INLINE const std::string matlab_format( const Eigen::SparseMatrix & S, const std::string name = ""); IGL_INLINE const std::string matlab_format( const double v, const std::string name = ""); IGL_INLINE const std::string matlab_format( const float v, const std::string name = ""); // Return just IOFormat // // Example: // // M := [1 2 3;4 5 6]; // cout<