Matlab: Suppressing the output

  • MATLAB
  • Thread starter matematikawan
  • Start date
  • Tags
    Matlab Output
In summary, suppressing output in Matlab is a way to prevent certain information or results from being displayed in the command window, which can be useful for large datasets or lengthy calculations. This can be achieved by using the "fprintf" function with a semicolon, and specific parts of the output can also be suppressed. To turn off output suppression, the semicolon can be removed, and output can be suppressed permanently by using the "diary" function with a file name as input.
  • #1
matematikawan
338
0
I get this example from >>help eval
and add a semicolon.for n = 1:12
eval(['M' num2str(n) ' = magic(n)']);
end

The above commands display all 12 magic square. How do I suppress the output? I only want MATLAB to assign the variables not display them.
 
Last edited:
Physics news on Phys.org

1. What is the purpose of suppressing output in Matlab?

The purpose of suppressing output in Matlab is to prevent the program from displaying certain information or results in the command window. This can be useful for large datasets or lengthy calculations where displaying all the output can slow down the program or make it difficult to read.

2. How do I suppress output in Matlab?

To suppress output in Matlab, you can use the "fprintf" function with a semicolon at the end of the line. This will print the results to the command window without displaying them.

3. Can I suppress specific parts of the output in Matlab?

Yes, you can suppress specific parts of the output in Matlab by using the "fprintf" function with a semicolon for the parts you want to suppress. You can also use the "disp" function to display specific results or information.

4. How do I turn off output suppression in Matlab?

To turn off output suppression in Matlab, you can remove the semicolon at the end of the line using the "fprintf" function. This will allow the program to display the results in the command window.

5. Is there a way to suppress output permanently in Matlab?

Yes, you can set the "diary" function in Matlab to record all the output to a file, effectively suppressing it from the command window. This can be done by using the "diary" function with a file name as an input, and using the "diary off" function to stop recording the output.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
Back
Top