how can i get output

input sample: x=[43 03 00 10]
output sample: y= 43030010
how can i get this output ???

回答 (3 件)

Andrei Bobrov
Andrei Bobrov 2013 年 1 月 16 日

0 投票

if
x = [43 3 0 10]; % double array
y = x*10.^(6:-2:0);
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 16 日
編集済み: Azzi Abdelmalek 2013 年 1 月 16 日

0 投票

x= [43 3 0 10]
y=[]
for k=1:numel(x)
y=[y num2str(x(k))];
end
y=str2num(y);
%or
y=str2num(cell2mat(arrayfun(@num2str,x,'un',0)))
Thorsten
Thorsten 2013 年 1 月 16 日
編集済み: Thorsten 2013 年 1 月 16 日

0 投票

str2num(sprintf('%02d', x))

この質問は閉じられています。

タグ

タグが未入力です。

質問済み:

2013 年 1 月 16 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by