Result of a function

조회 수: 7 (최근 30일)
Omer Acil
Omer Acil 2020년 5월 24일
댓글: dpb 2020년 5월 24일
Hello,
function encStr=encrypt(s,key)
encStr=char(s+key);
end
This is my base function I want to define a encStr to use it later but after using the function I have an error
>> encrypt('demi',3)
ans =
'ghpl'
>> encStr
Unrecognized function or variable 'encStr'.
Can you help me please? Thanks!
  댓글 수: 3
Omer Acil
Omer Acil 2020년 5월 24일
Is there a way that I can store my answer and define it with a name?
dpb
dpb 2020년 5월 24일
Yes. Just call your function like any other MATLAB function with a variable name on the LHS of an assignment.
As noted, read the basic information and examples on using functions.
You assigned a result inside your function, there's no difference at the calling level syntax-wise.

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

답변 (0개)

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by