How to count total number of characters

I have a single verticle matrix, 32x1, and it has random values that range from 9870 to -889. I need to count how many total number of characters are in this array. It should be easy, but I can't figure out the call term. I've tried length, isspace, sum, but all they keep giving me is 32. help

4 Comments

Random numbers or characters?
numbers, sorry for the confusion
But you said that you have 32x1 array, which means 32 numbers. Please post a sample of your data
32 numbers as in
3 4 90 76 -877
That is 5 numbers, but I need my answer to show that it is 9 characters/numbers (kind of confused on what to call them)

Sign in to comment.

 Accepted Answer

a=[3 4 90 76 -877]
b=num2str(a)
out=numel(regexprep(b,'[\s-]+',''))

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!