Clear Filters
Clear Filters

extracting data from double string

2 views (last 30 days)
Alex
Alex on 11 Nov 2011
Hey guys,
I am putting together a display from data in a data structure and I have hit a road block...
So far I have coded in this manner:
%Display Names
single_example = example(1)
cell_space = blanks(100)
names = single_example.names;
single_name = names{1};
row1a = cell_space(1:9)
row1a = ' Name: '
row1b = cell_space(10:100)
row1b(1:length(single_name)) = single_name;
display_row1 = ['|', row1a, row1b, '|']
%which results in: | name: Alex |
but I now face the problem that I need to reference a cell that has multiple lines of date rather than just one 1x1 cell. for example: classes = [Math;Science;English]
my ultimate goal is to have it display:
| Classes: Math (10 spaces) Science (10 spaces) English |
Also for each student the number of classes they are taking changes so that adds another layer to the problem.
Any help would be much appreciated. Thanks
  1 Comment
Jan
Jan on 11 Nov 2011
Please format your code as explained in the "Markup help" link on this page.

Sign in to comment.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 11 Nov 2011
use fprintf() or sprintf() is easier. Check the help of sprintf() for format details.

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!