split numbers into columns

조회 수: 3 (최근 30일)
Kerstin Olsson
Kerstin Olsson 2017년 5월 4일
댓글: ahcen aliouat 2020년 10월 6일
I have a column vector, A which is 1x1500, and each element in each row contains several variables in each element. I would like to split these into separate columns. In the columnvector each element has 15 numbers, like A(1,1)= 123456789123456. And what I would like to have is B1 = 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6.
Basically, I'm looking for a line of code which can add space between each number in the elements of my column vector. Anyone knows?
  댓글 수: 4
Kerstin Olsson
Kerstin Olsson 2017년 5월 4일
I made a typo on the dimensions, it is 1500x1. So, I'm looking for a command that in general would create space between numbers in a vector, or pick out parts of elements in a vector. I would know how to pick out elements of course, but not parts of elements..
Kerstin Olsson
Kerstin Olsson 2017년 5월 4일
Thanks KL! Got it now :)

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

답변 (1개)

Stephen23
Stephen23 2017년 5월 4일
If the input is numeric, try this:
num = 123;
num2str(num)-'0'
  댓글 수: 1
ahcen aliouat
ahcen aliouat 2020년 10월 6일
thank you . that work perfectely!

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by