How to put names of events in a listed vector?

1 view (last 30 days)
I want to put names in a column vector like this: Event1 Event2 etc
The only way to can do this right now is if I make each event the same size using space bar (or a period because a spacebar wont show up in the question) like this: a=[event1..;event345;event45.;etc....];
As you can see they are all the same size. However, this is a problem because 1) it takes forever and 2) when it comes to plot these names, all the letters of a single name plot in the exact same area, making it unreadable if that makes sense. How do I change this? Thanks.

Accepted Answer

James Tursa
James Tursa on 3 Jul 2014
Can you use a cell array of strings instead? E.g., {'event1','event345','event45', etc }. That way the strings do not need to be the same length with blank padding at the end. Also, several MATLAB functions work with cell arrays of strings as inputs.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!