MATLAB - basic questions
Posted on 2004-10-29
1) How do I print a formatted string to screen? sprintf also prints "ans = ...". fprintf works perfectly well, but this doesn't seem to be the most elegant way, because this is used for writing to files (and I cannot specify print to stdout, like in C).
2) How do I pass parameters by reference to a function?
3) When I write "load f1.txt", "load f2.txt" etc, the matrixes are
loaded into f1, f2 etc. Can I load it to a certain variable NOT with the name of the file? (I want it to be loaded to "f", for example).Of course I can read into f1, and then just copy into f, and then clear f1, but I have hundreds of files, and this will take extra time.
Something else that could solve this is to define a pointer. I.e. load the file into f1, and then assign f to be a pointer to f. I prefer the first way (difect reading to "f"), but if it's impossible, a pointer will also do...