Merge two arrays one after each other by elemnets

1 次查看(过去 30 天)
I have an array a1=[1 2 3 4 ... 50] I also have string '*GOAL'
I want to create a single string B that can produce:
*GOAL 1
*GOAL 2
*GOAL 3
*GOAL 4
*GOAL 5
...
I want to use this string B and replace a character [$1] that is inside a text file 'Goals.txt'.

采纳的回答

KSSV
KSSV 2017-3-31
str1 = 'GOAL ' ;
idx = 1:50 ;
str1 = repmat(str1,length(idx),1) ;
iwant = [str1,num2str(idx')]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by