Hello,
How can I sepererate numbers in a cell with respect to semi colon seperating them? E.g. number is given below
a={1000000000;-46,924118041992187;}
I have tried with this command but it sepererates number with semi colon and comma.
b=regexp(a,'\d+(\;)?(\d+)?','match')
.

7 commentaires

KSSV
KSSV le 31 Mar 2017
a is cells of numbers or string?
antennist
antennist le 31 Mar 2017
Numbers.
Jan
Jan le 31 Mar 2017
Modifié(e) : Jan le 31 Mar 2017
What does
a = {1000000000;-46,924118041992187;}
mean exactly?
a = '{1000000000;-46,924118041992187;}'
a = {'1000000000;-46,924118041992187;'}
'a = {1000000000;-46,924118041992187;}'
KSSV
KSSV le 31 Mar 2017
Modifié(e) : KSSV le 31 Mar 2017
a={1000000000;-46,924118041992187;}
didn't this throw a error? Comma is not allowed...
antennist
antennist le 31 Mar 2017
Modifié(e) : antennist le 31 Mar 2017
Yes this is cell containing two double values. a = {1000000000;-46,924118041992187;}
KSSV
KSSV le 31 Mar 2017
a={1000000000;-46924118041992187}
you can use a{1} and a{2}. Thus they are separated??
antennist
antennist le 31 Mar 2017
@KSSV consider it a long number in a single cell.

Connectez-vous pour commenter.

 Réponse acceptée

Jan
Jan le 31 Mar 2017

1 vote

If you mean
a = {'1000000000;-46,924118041992187;'}
use
str = strrep(a{1}, ',', '.');
n = sscanf(str, '%g;%g')

Plus de réponses (0)

Catégories

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by