Closed ramcdougal closed 5 days ago
Before we had Fprintf
, calling e.g., h.topology()
from a Jupyter notebook would cause the results to appear in the terminal not in the notebook.
As far as I can tell, anything sent to std::cout
when running via clib from MATLAB in Windows goes nowhere.
Possibly relevant (found by Matze): https://stackoverflow.com/questions/243696/correctly-over-loading-a-stringbuf-to-replace-cout-in-a-matlab-mex-file
@alkino : maybe you could take a look?
I'm not sure when this happened, but I noticed that
std::cerr
andstd::cout
have crept into the code base.These are not equivalent to
Fprintf
.Capital
Fprintf
exists because it allows us to route NEURON's output to appear in a Jupyter notebook or in a MATLAB console by passing a function pointer for handling the printing tonrnpy_set_pr_etal
.See e.g., https://github.com/neuronsimulator/nrn/blob/c918f6b9ff9be32828e882ed51106d8449e7cb6c/share/lib/python/neuron/__init__.py#L1647
and its following lines for Python, or the following for MATLAB:
https://github.com/mcdougallab/matlabneuroninterface/blob/89c6283de6c5b243ef4a517793e46f2457e5b934/source/nrnmatlab.cpp#L48