Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ascii 2 letter

Subject: ascii 2 letter

From: Jessica

Date: 13 Mar, 2013 17:40:08

Message: 1 of 2

I am trying to create an array:

File_EndTime=Data1(r,7);
File_Behavior=Data3(r+1,5); File_Behavior=char(File_Behavior);

OutputData(r,2)=File_EndTime;
OutputData(r,3)=File_Behavior;

However, the OutputData(r,3) turns my letters to numbers:

File_Behavior =H

OutputData(1,3)

ans =

    72

How can I make is so the "H" appears in the OutputData array?

Subject: ascii 2 letter

From: dpb

Date: 13 Mar, 2013 18:28:48

Message: 2 of 2

On 3/13/2013 12:40 PM, Jessica wrote:
> I am trying to create an array:
>
> File_EndTime=Data1(r,7);
> File_Behavior=Data3(r+1,5); File_Behavior=char(File_Behavior);
>
> OutputData(r,2)=File_EndTime;
> OutputData(r,3)=File_Behavior;
>
> However, the OutputData(r,3) turns my letters to numbers:
>
> File_Behavior =H
>
> OutputData(1,3)
>
> ans =
>
> 72
>
> How can I make is so the "H" appears in the OutputData array?

Only by either displaying it via char() or storing the ASCII as a
character string in cell array or a named-field structure. Matlab can't
mix numeric and non-numeric data in a single "ordinary" array of doubles.

--

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us