How can I round numbers from a column?

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)

 Accepted Answer

madhan ravi
madhan ravi on 14 Jun 2020
Edited: madhan ravi on 14 Jun 2020
round(C{:,1})

10 Comments

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

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2016a

Community Treasure Hunt

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

Start Hunting!