Seperting numbers in a cell

2 visualizzazioni (ultimi 30 giorni)
antennist
antennist il 31 Mar 2017
Commentato: antennist il 31 Mar 2017
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 Commenti
KSSV
KSSV il 31 Mar 2017
a={1000000000;-46924118041992187}
you can use a{1} and a{2}. Thus they are separated??
antennist
antennist il 31 Mar 2017
@KSSV consider it a long number in a single cell.

Accedi per commentare.

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Numeric Types in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by