How to count total number of characters

5 views (last 30 days)
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
Azzi Abdelmalek
Azzi Abdelmalek on 5 Oct 2013
Edited: Azzi Abdelmalek on 5 Oct 2013
But you said that you have 32x1 array, which means 32 numbers. Please post a sample of your data
Brady
Brady on 5 Oct 2013
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

Azzi Abdelmalek
Azzi Abdelmalek on 5 Oct 2013
a=[3 4 90 76 -877]
b=num2str(a)
out=numel(regexprep(b,'[\s-]+',''))

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!