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??
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 1월 16일
Is the input a string or numeric?

댓글을 달려면 로그인하십시오.

채택된 답변

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에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by