Borrar filtros
Borrar filtros

extracting data from double string

2 visualizaciones (últimos 30 días)
Alex
Alex el 11 de Nov. de 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 comentario
Jan
Jan el 11 de Nov. de 2011
Please format your code as explained in the "Markup help" link on this page.

Iniciar sesión para comentar.

Respuestas (1)

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

Categorías

Más información sobre Operators and Elementary Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by