Convert an integer to a string

We have function in octave to convert an integer or an array of integer to a string or a character array. This function is ‘int2str()’.

>>int2str(123)

=>"123"

>> s = int2str([1,2,3;4,5,6])

=> s = 1 2 3

4 5 6

>> whos s

=> gives the output as below

attr name = s, size = 2x7, bytes = 14 and class = char

This function is not very flexible. For better control over the results, use sprintf().

Advertisements

Published by

kaurdavinder

I am the one who discover myself daily through reading, writing, interacting with people and expressing my thoughts to inspire them if I would be able to bring a little change to the society through my work. I write blogs, participate in various social activities and want to be a Professional Speaker. Currently, I am pursuing my post graduation in Computer Applications from Guru Nanak Dev Engineering College, Ludhiana and I’m very much active in many technical & social communities.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s