Executing a fprintf statement with a function

조회 수: 3 (최근 30일)
Teoman Selcuk
Teoman Selcuk 2021년 12월 3일
답변: Image Analyst 2021년 12월 3일
How would I be able to pass and fprintf a tsring in the code below? The code below is faulty and not working
a= pass('hello');
function output = pass(var)
fprintf('%s', var);
end

답변 (1개)

Image Analyst
Image Analyst 2021년 12월 3일
Get rid of a=, or else assign a inside of the function. Right now you are trying to accept something into a in your calling routine, but the function does not pass anything back. So call it like this:
pass('hello');

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by