1
votes

How do I display the current value of a variable in the matlab command window? In matlab I usually use disp(var) and it will output the variable value into the command window. However in the MATLAB function block if I were to enter disp('hello') it doesn't show any output in the command window. I am using matlab 2014b.

1
Simulink works separately and differently from MATLAB. Why would you want to do this? small simulations can take +1000000 iterations ("steps") in Simulink, you will clog your command windowAnder Biguri
i want to see the values the variables have, because i keep getting the error that one of them is trying to access an array element of size greater than it can. This doesn't make sense to me since I feed three inputs (of which two are constants) into a bus and use that as the input for the function block. However it the function block doesn't seem to see the three inputs.jusC

1 Answers

1
votes

You idea for displaying output value in the command window is not a good approach to solve your issue. I would suggest you look at scope block if you'd like to see the value during simulation. Or use To Wrokspace block if you'd like to output the value into main workspace.

For debugging your code and design, read and use Simulink Debugger should be helpful.