Borrar filtros
Borrar filtros

How remove empty spaces

4 visualizaciones (últimos 30 días)
elisa ewin
elisa ewin el 11 de Mayo de 2016
Respondida: Chad Greene el 11 de Mayo de 2016
Hi, I want to remove the spaces from s; how can I do?
s={[2005 1 26;2005 1 27;2005 1 28]}
  2 comentarios
Guillaume
Guillaume el 11 de Mayo de 2016
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 el 11 de Mayo de 2016
elisa, Guillaume is right. You must not understand cell arrays. Please read the FAQ to get a good understanding of them.

Iniciar sesión para comentar.

Respuesta aceptada

Chad Greene
Chad Greene el 11 de Mayo de 2016
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

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by