convert number to string but keep it the same as it is
Show older comments
Hi,
I have a Matrix containing different time series and I gave them numbers (2000001, 2000002,2000003 etc.) and I would like to convert this numbers into a string. If I use int2Str I get some Kind of matlab representation of this number, but this is not what I am looking for. What I need is at the end a vector as follows:
A=['2000001','2000002','2000003', etc.]
how can I achieve this by a automatic command?
regards
Accepted Answer
More Answers (2)
Youssef Khmou
on 19 Sep 2014
Edited: Youssef Khmou
on 19 Sep 2014
You can achieve that command using transformation from matrix to cells, if M is your matrix :
M=magic(10);
N=size(M);
B=mat2cell(num2str(M(:)),ones(N(1)*N(2),1));
B=reshape(B,N(1),N(2));
Categories
Find more on Characters and Strings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!