From the course: MATLAB 2018 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create a custom string using sprintf

Create a custom string using sprintf - MATLAB Tutorial

From the course: MATLAB 2018 Essential Training

Start my 1-month free trial

Create a custom string using sprintf

- [Instructor] Elsewhere in this course, I showed you how to write formatted output to the string using an F print F statement. In this movie, I'll show you how to write that same output to a string variable using the sprint F or S print F function. I am at a blank MATLAB command window, but I need to create a script. So I will go to the home tab and click New Script and I'm in a blank editor window. The S print to F function allows you to write formatted output to a string. And as comments I will indicate the foremost common codes that you use to indicate the format. To enter a comment, type a percent sign and then the code for a decimal is percent D for decimal. And then percent F for floating point real number. I'll just call it floating point. Then I'll press enter and I'll do another line of comments so starting it with a percent sign. Percent S is a string. And percent C is a character. Okay, so with those bits of information in mind, I can press Enter and get some data. I'll…

Contents