vitokr
vitokr

Reputation: 87

How can I prevent external function from writing to console?

I have a MatLab function in which I have a for-loop that make a call in every iteration to an external function from a library.

Unfortunately this function produces a hundred lines of console output on every call and my for-loop (parfor to be precise) has a number of iterations in the order of 10k-100k!

So I am addressing basically 2 problems:

The first problem is the most annoying at the moment but I would like to solve both.

I am wondering if there is a way to prevent a function to produce text output.

Upvotes: 0

Views: 168

Answers (1)

Daniel
Daniel

Reputation: 36710

There are two possibilities:

  1. You can create a private folder next to the function and place an empty function fprintf (or whatever is used to print) inside. This way you are overwriting the build-in function with a new one simply doing nothing.
  2. use evalc to run the function.

Upvotes: 2

Related Questions