About 147,000 results
Open links in new tab
  1. printing - How to print a string in Matlab? - Stack Overflow

    Feb 25, 2014 · I do this to output the contents of a string (and nothing more): fprintf( '%s', my_str ); but it feels like I've missed a function that takes only my_str as an argument.

  2. disp - Display value of variable - MATLAB - MathWorks

    disp(X) displays the value of variable X without printing the variable name. Another way to display a variable is to type its name, which displays a leading “ X = ” before the value. If a variable contains an empty array, disp returns without displaying anything.

  3. Formatting Text - MATLAB & Simulink - MathWorks

    To convert data to text and control its format, you can use formatting operators with common conversion functions, such as num2str and sprintf. These operators control notation, alignment, significant digits, and so on. They are similar to those used by the printf function in the C programming language.

  4. sprintf - Format data into string or character vector - MATLAB

    Input text without formatting operators, specified as a character vector or string scalar. sprintf translates any escape-character sequences in literalText. Data Types: char | string

  5. matlab: how to print string and variable inline - Stack Overflow

    Nov 11, 2020 · You can use disp function to print and num2str to convert number to string. disp (['a :: ' num2str(a) ' :: b :: ' num2str(b)]

  6. How do I print (output) in Matlab? - dspGuru

    There are three common ways: Type the name of a variable without a trailing semi-colon. Use the “disp” function. Use the “fprintf” function, which accepts a C printf-style formatting string. Here are examples: 1 2 3 4. Notes: “fprintf” uses the formatting string on each element of the variable.

  7. MATLAB:how can I use fprintf or sprintf to print matrix and …

    Nov 1, 2015 · 1) If I want to print a matrix, preceeded by a string, using the fprintf command, how can I do? For example, to print a matrix alone, I use. But how can I print a string followed by the matrix, all togheter in fprintf, without usind the disp function ? For example, if I want to print:

  8. Matlab Code - fprintf - University of Utah

    Below are several examples of printing information from variables using fprintf. Notice the use of %s to print a string, and %d to print an integer, and %f to print a number with a decimal (a floating point number).

  9. The Complete Guide to Formatted Text Output with fprintf in MATLAB

    Dec 27, 2023 · The fprintf function in MATLAB allows you to print formatted text and data to the screen or save output to files. With fprintf, you have precise control over: Number formatting – decimals, floats, scientific notation; String manipulation – padding, alignment, truncation; Matrix and structure printing – spacing, precision

  10. How to display a string and matrix in MATLAB?

    Feb 18, 2014 · To display some text and a matrix, you can use two disp statements. This makes the code easy to understand and maintain. If a one line solution is needed, you can use the num2str function to convert the matrix to a character array. This displays the contents of the array as a row vector though, changing the original shape of the matrix.

  11. Some results have been removed
Refresh