How remove empty spaces

조회 수: 9 (최근 30일)
elisa ewin
elisa ewin 2016년 5월 11일
답변: Chad Greene 2016년 5월 11일
Hi, I want to remove the spaces from s; how can I do?
s={[2005 1 26;2005 1 27;2005 1 28]}
  댓글 수: 2
Guillaume
Guillaume 2016년 5월 11일
What spaces? s is a cell array consisting of a single cell. That single cell contains a matrix of numbers. There are no spaces
If you are asking for a particular way to display these numbers, please be clearer on what display you want.
Image Analyst
Image Analyst 2016년 5월 11일
elisa, Guillaume is right. You must not understand cell arrays. Please read the FAQ to get a good understanding of them.

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

채택된 답변

Chad Greene
Chad Greene 2016년 5월 11일
Those s values look like dates. Here are a couple of options:
s = {[2005 1 26;2005 1 27;2005 1 28]};
% Get s as a character array:
s2 = datestr(datenum(s{:}),'yyyymmdd')
= 20050126
20050127
20050128
% Get s2 as numbers:
s3 = str2num(s2)
= 20050126
20050127
20050128

추가 답변 (0개)

카테고리

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