Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

help with creating certain function for setting elements in one matrix to another

조회 수: 2 (최근 30일)
Jessie Ray
Jessie Ray 2017년 11월 4일
마감: MATLAB Answer Bot 2021년 8월 20일
want to make function that takes in text, and then creates a matrix that sets each element to one of the ascii code elements
for example: [abcdef] would get set to [1 2 3 4 5 6]
and [help] would get set to [8 5 12 16]
pls help

답변 (1개)

the cyclist
the cyclist 2017년 11월 4일
Here's one way:
alphabet = 'abcdefghijklmnopqrstuvwxyz';
[~,vec] = ismember('help',alphabet)
  댓글 수: 9
Stephen23
Stephen23 2017년 11월 4일
편집: Stephen23 2017년 11월 4일
"I stored them all as one vector called 'text1'"
Stored where? In some file, in a matrix in MATLAB, or printed on a piece of paper? How did you define this matrix?

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by