How to insert symbols in a vector in Matlab
7 views (last 30 days)
Show older comments
Habib Khan
on 9 Aug 2016
Edited: Azzi Abdelmalek
on 10 Aug 2016
I have a vector of 12 entities in Matlab. a=[3 4 6 8 1 5 8 9 3 7 3 6 ] I want to insert symbols at regular intervals along with the values. The final value of a looks like this. a=[#3 4@ 6& 8< #1 5@ 8& 9< #3 7@ 3& 6<] As can be seen that the symbols are being repeated after 3 entities. How can this be achieved in Matlab ?
1 Comment
Adam
on 9 Aug 2016
You can do that as a string, but not in a numeric vector because obviously those elements are not numeric. If you have a vector of chars then it is trivial depending at what point you have the various information to create the end result.
Accepted Answer
Azzi Abdelmalek
on 9 Aug 2016
Edited: Azzi Abdelmalek
on 9 Aug 2016
a=[3 4 6 8 1 5 8 9 3 7 3 6 ]
str=strsplit(sprintf('#%d %d@ %d$ %d< ',a) )
str(end)=[]
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!