Search code examples
c++matlabfilestream

Moving files in matlab


I am working on a project in which i am asked to create 500 random numbers in c++ and store them in text file through file handling and open that specific file in MAT LAB for further processing. As i write the file in c++,it is created in the project directory of my c++ compiler while to open that file in MAT LAB i need that file to be placed in the MAT LAB's directory,how can i move it over there? or is there any other command which i don't know in MAT LAB which used to open file from other directory?

P.S( I don't want to copy or move that file manually ,but to move it through or command aor open it directly )


Solution

  • You should not have any problem reading the file using MATLAB's fopen by adding the path of your file before the filename.

    However, if you really want to move a file in MATLAB, just use movefile. It will work, but there is no reason it would be any easier, and it would be a bit slower.