フィルターのクリア

how to merge two string vectors and get third vector?

2 ビュー (過去 30 日間)
Mudasir Ahmed
Mudasir Ahmed 2016 年 10 月 24 日
コメント済み: Mudasir Ahmed 2016 年 10 月 24 日
hi
I have two decimals number I convert them in binary strings '00011011010001' and '00110110100010' and I want to merge them like:
total strings are 14. I want to take starting 5 digits of the first string and merge them with the 6 to 14 digits of the second string like '00011110100010' as an output
a=1745
b=3490
c = reshape(cellstr(dec2bin(a)), size(a))
d = reshape(cellstr(dec2bin(b)), size(b))
e=cellfun(@(s) [s(1:5)], c, 'UniformOutput', false)
f=cellfun(@(s) [s(6:14)], d, 'UniformOutput', false)
now, how I merge e and f to get '00011110100010'. kindly help me I will highly thankful to you.
regards

採用された回答

KSSV
KSSV 2016 年 10 月 24 日
str1 = '00011011010001' ;
str2 = '00110110100010' ;
str3 = strcat(str1(1:5),str2(6:14)) ;
  1 件のコメント
Mudasir Ahmed
Mudasir Ahmed 2016 年 10 月 24 日
Thank you so much sir :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by