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:
int2str versus str2int?

Subject: int2str versus str2int?

From: justin

Date: 4 Apr, 2004 23:59:27

Message: 1 of 3

Hello,

I am trying to create a uicontrol edit text box, and get the user
input string to be read as a value: The user will actually put in a
number.

*************************************
function edit2_Callback(hObject, eventdata, handles)

handles.deltaSPL=get(handles.edit2,'String')
guidata(hObject, handles)
*************************************

This seems to give handles.delta as a string, thus reads its ASCII
value when I try to use it in calculations.

The 'int2str' function converts a number to a string, is there a
function that does the reverse?

Thanks heaps,
Justin.

Subject: int2str versus str2int?

From: NC

Date: 5 Apr, 2004 00:20:46

Message: 2 of 3

Use STR2DOUBLE. You may also want to use ROUND to get integer values.

Subject: int2str versus str2int?

From: justin

Date: 5 Apr, 2004 00:27:51

Message: 3 of 3

WOW, that was quick!

Thankyou so much for your help, I didn't see that in the help/doc
files before. It also led me to str2num(), which will probably be
just as good for an integer. should round it off to get to an integer
anyway.

Thanks again,

Justin.

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