I’m new to Matlab and I have a function and I need to display a variable from running the main file (but the main file does access the function)…
I have tried to use fprintf(n);
Thanks 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MATLAB function
fprintf()is very similar tofprintf()in C. If your variablenis an integer, then you should doAn interesting feature is that you can also print multiple numeric values and literal text to the screen. For example
where
%4.2ftakes the element at the first column ofA1and%8.3ftakes the second. In the sequence, it repeats forA2printing its first line and later its second line. The output isIf you want more details about the specifiers you can use with
fprintf(), you should give a look at the MathWorks docs.