how can i get output

1 次查看(过去 30 天)
mukim
mukim 2013-1-16
input: "391632"
i want output:
i=39, j=1632
how can i get it??

采纳的回答

Walter Roberson
Walter Roberson 2013-1-16
A = 391632
i = floor(A/10000);
j = mod(A, 10000);

更多回答(3 个)

Andrei Bobrov
Andrei Bobrov 2013-1-16
编辑:Andrei Bobrov 2013-1-16
s = '391632';
out = str2double(mat2cell(s,1,[2 4]));
or
a = s - '0';
out = [polyval(a(1:2),10), polyval(a(3:end),10)];
or
a = s - '0';
out = [a(1:2)*[10; 1], a(3:end)*10.^(3:-1:0)'];

mukim
mukim 2013-1-16
the input is numeric input: 391632

mukim
mukim 2013-1-16
tnx.. Walter Roberson .. :)

类别

Help CenterFile Exchange 中查找有关 Chemistry 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by