Hi,
I have:
load('work.mat');
C = T(:,2);%read second column
C{:, 1} = regexprep(C{:, 1}, '[(ms)]', '');%eliminate text after numbers
X = round(C)
How do I round the numbers after I delete the text ?
____________________________________________________
Undefined function 'round' for input arguments of type 'table'.
Error in Runscript (line 8)
X = round(C)

 Akzeptierte Antwort

madhan ravi
madhan ravi am 14 Jun. 2020
Bearbeitet: madhan ravi am 14 Jun. 2020

0 Stimmen

round(C{:,1})

10 Kommentare

Cristian Martin
Cristian Martin am 14 Jun. 2020
X = round(C{:,1})
Undefined function 'round' for input arguments of type 'cell'.
Error in Runscript (line 8)
X = round(C{:,1})
round([C{:,1}])
Cristian Martin
Cristian Martin am 14 Jun. 2020
I guess there are no new variable after erasing the text, I consider C for round but C does content the text after numbers
madhan ravi
madhan ravi am 14 Jun. 2020
I don’t have your file so I can’t suggest anything.
Cristian Martin
Cristian Martin am 14 Jun. 2020
In a minute I will put the file
Cristian Martin
Cristian Martin am 14 Jun. 2020
Bearbeitet: Cristian Martin am 14 Jun. 2020
This is what I want to round
round(str2double(C.Var2))
Cristian Martin
Cristian Martin am 14 Jun. 2020
Thank Ravi it worked, can explain str2double please ?
doc str2double
Cristian Martin
Cristian Martin am 14 Jun. 2020
Thank You Ravi !

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Produkte

Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by