logo for matrixlab-examples.com
[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Welcome Matrixmania Blog
-> Sitemap / Search <-
-> Books <-
Forums and Help
Contact
Basics Quick Matlab Guide
Matlab Tutorial
Matlab Examples
Matlab Flow Control
Boolean Logic
Plots and GUI Matlab 2D Plots
Matlab 3D Plots
Matlab GUI
Applications Calculus
Linear Algebra
Matlab Cookbook I
Matlab Cookbook II
Electrical Calculations
Probability and Stats
Finance Apps
Other Relevant Links
Notes on Computing
Online Calculators
Fun!
Your own Website?
Terms/Policies
Scilab
leftimage for matrixlab-examples.com

String Concatenation in Matlab


This video shows how to attach numbers to strings, that is, how to accomplish number to string concatenation.
 

You can use this technique to make a sequential list of titles, file names... or whenever a variable needs to be put in a string.

This is done with the built-in function num2str and loops. If you type ‘help num2str’ on your Matlab command window, you get the following description:

NUM2STR Convert numbers to a string.
T = NUM2STR(X) converts

the matrix X into a string representation T with about 4 digits and an exponent if required. This is useful for labeling plots with the TITLE, XLABEL, YLABEL, and TEXT commands. 

It means that you then get a string version of the number and can concatenate it to other strings in a logic sequence. A string is a row vector of characters and you can put them inside a pair of brackets. This technique is not recommended to create variables like a1, a2, a3... in that case it’s better to use some type of indexing, like a(1), a(2)... or, in general a(i), where i is a positive integer.
 

 From 'String Concatenation' to home

 From 'String Concatenation' to 'Matlab Examples'
   

Top

Long strings: Check writer
 



footer for string concatenation page