필터 지우기
필터 지우기

How do i change the input to make it any word I type in?

조회 수: 1 (최근 30일)
Mohannad Abboushi
Mohannad Abboushi 2016년 3월 30일
답변: Walter Roberson 2016년 3월 30일
In this program I am supposed to take a character array s as input and return a new character array with each letter shifted forward once in the alphabet (Assuming that the input s will never contain the letter 'z'.)
So far here's my code:
function S = shiftletters('apple')
S=char('a':'z'+1);

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 30일
In a function line, you need to name a variable that will receive the passed value, such as
function S = shiftletters(TheInputWord)
Then inside the function your code should act upon the contents of that variable name (such as TheInputWord). For example to reverse the input you could use
fliplr(TheInputWord)

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by