Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

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

1 visualizzazione (ultimi 30 giorni)
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

Risposte (1)

the cyclist
the cyclist il 4 Nov 2017
Here's one way:
alphabet = 'abcdefghijklmnopqrstuvwxyz';
[~,vec] = ismember('help',alphabet)
  9 Commenti
Stephen23
Stephen23 il 4 Nov 2017
Modificato: Stephen23 il 4 Nov 2017
"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?

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by