How to insert symbols in a vector in Matlab

3 次查看(过去 30 天)
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 个评论
Adam
Adam 2016-8-9
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.

请先登录,再进行评论。

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-8-9
编辑:Azzi Abdelmalek 2016-8-9
a=[3 4 6 8 1 5 8 9 3 7 3 6 ]
str=strsplit(sprintf('#%d %d@ %d$ %d< ',a) )
str(end)=[]
  2 个评论
Habib Khan
Habib Khan 2016-8-10
@Azizi & @Star Strider. Thanks for the reply. Solutions suggested by both of you are OK. But can I get the solution without the '' (commas). How can I do it.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by