필터 지우기
필터 지우기

fill structure

조회 수: 2 (최근 30일)
Trader
Trader 2012년 4월 2일
How do you fill a structure with a large amount of values? For example, I've preallocated my structure as:
met.position = cell(400, 1);
I'd like all 400 rows to equal 'string' or some character value. I could fill it with a loop but is there a shorter/easier way?
Thanks!

채택된 답변

Jan
Jan 2012년 4월 2일
met.position = cell(400, 1);
met.position(:) = {'default'};
Or:
met.position = repmat({'default'}, 400, 1);
  댓글 수: 1
Trader
Trader 2012년 4월 2일
You're the man Jan, thank you!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by