The uses of fprintf and sprintf?

What are the exact uses for fprintf and sprintf? How do the two command differ and how should I know which command to use? Also using such a command to create a .txt file.

댓글 수: 1

per isakson
per isakson 2015년 2월 15일
편집: per isakson 2015년 2월 15일
The one creates a string in the work space the other prints to a file or the command window. The details are in the documentation.

댓글을 달려면 로그인하십시오.

답변 (1개)

Stephen23
Stephen23 2015년 2월 16일
편집: Stephen23 2015년 5월 22일

6 개 추천

Some background: the name "printf" comes from "PRINT Formatted" and occurs in many programming languages. In MATLAB this is extended with the two versions:
  • fprintf means "File PRINT Formatted": use this for printing text to a file or the command window.
  • sprintf means "String PRINT Formatted": use this for creating a MATLAB string ( character vector ).

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2015년 2월 15일

편집:

2015년 5월 22일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by