split array

if A = [1234567891234567];===> size(A) = 1*1
in one cell
I want split it as each (8digit) in one cell as:
A = [12345678;91234567];=====> size(A)= 2*1

답변 (3개)

Krishnendu Mukherjee
Krishnendu Mukherjee 2012년 2월 18일

0 개 추천

for i=1:(size(A(1,:))/2) B(1,:)=A(1,i); end for i=(size(A(1,:))/2):size(A(1,:)) B(2,:)=A(1,i); end try this.it may work

댓글 수: 3

Aseel H
Aseel H 2012년 2월 18일
error
??? Subscript indices must either be real
positive integers or logicals.
Krishnendu Mukherjee
Krishnendu Mukherjee 2012년 2월 19일
for i=1:(size(A(1,:))/2) B(1,i)=A(1,i); end for i=(size(A(1,:))/2):size(A(1,:)) B(2,i)=A(1,i); end try this.it may work
1 comment
Krishnendu Mukherjee
Krishnendu Mukherjee 2012년 2월 19일
i was in hurry yesterday.thats why little mistake

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

Andrei Bobrov
Andrei Bobrov 2012년 2월 18일

0 개 추천

A = 1234567891234567
B = reshape(num2str(A)-'0',[],2).'
Anew = B*10.^(size(B,2)-1:-1:0).'
Walter Roberson
Walter Roberson 2012년 2월 18일

0 개 추천

Your A is 16 digits long. You might not be able to store it accurately as a floating point number.

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

질문:

2012년 2월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by