Effacer les filtres
Effacer les filtres

extracting data from double string

2 vues (au cours des 30 derniers jours)
Alex
Alex le 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 commentaire
Jan
Jan le 11 Nov 2011
Please format your code as explained in the "Markup help" link on this page.

Connectez-vous pour commenter.

Réponses (1)

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

Catégories

En savoir plus sur Operators and Elementary Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by