extracting data from double string
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Fangjun Jiang
2011-11-11
use fprintf() or sprintf() is easier. Check the help of sprintf() for format details.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!