필터 지우기
필터 지우기

extracting data from double string

조회 수: 2 (최근 30일)
Alex
Alex 2011년 11월 11일
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
Jan
Jan 2011년 11월 11일
Please format your code as explained in the "Markup help" link on this page.

댓글을 달려면 로그인하십시오.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by