When I save a data via .save function, the file is saved under the folder where I have my cpp project.
I would like to save my data to a folder which I've specified. How can I do that?
mat histreal; //data I want to save.
histreal.save("histname.dat", raw_ascii); //saved where my project is
This is quite simple... just use the full path where you want to save your file. This is called "absolute path", compare to what you're doing, which is called "relative path". So, if you're using Windows:
If you're using Linux:
Remember that in Windows you shouldn't use normal backslashes, i.e.,
, but instead either use slashes like I did
/ or use double backslashes
\\. This is because a backslash combined with some other character normally can be replaced by other characters in a string. For example:
\n is a new line, and
\t is a tab.