How to draw the values of a comma-separated list with 100 values?

조회 수: 1 (최근 30일)
Tony Castillo
Tony Castillo 2023년 3월 16일
편집: Stephen23 2023년 3월 16일
Dear Mathlab Collaborators,
I am trying to draw some information from an struct format unsuccessfully, the software retrieve me this message:
struct with fields:
DT_span: [97×1 datetime]
consumo_cum: [1×1 struct]
tomato_values: [97×1 double]
clima_st: [1×1 struct]
crop_st_2: [1×1 struct]
crop_st: [1×1 struct]
cc_st: [1×1 struct]
PowerH2COM: [97×1 double]
Th: [97×1 double]
subs_st: [1×1 struct]
input_parameters: [1×1 struct]
total: [1×1 struct]
> best_benefit_span.sim.PowerH2COM
Intermediate dot '.' indexing produced a comma-separated list with 100 values, but it must produce a single
value when followed by subsequent indexing operations.
How to deal with this?
Thanks in advance.
  댓글 수: 2
Mathieu NOE
Mathieu NOE 2023년 3월 16일
can you sahre your structure (mat file) ?
Tony Castillo
Tony Castillo 2023년 3월 16일
This works for you?
> best_benefit_span
best_benefit_span =
1×100 struct array with fields:
sim
benefit

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

채택된 답변

Stephen23
Stephen23 2023년 3월 16일
편집: Stephen23 2023년 3월 16일
Assuming that every field POWERH2COM contains arrays of the same size, and also that every SIM structure contains exactly the same fieldnames.
tmp = [best_benefit_span.sim];
out = [tmp.PowerH2COM] % 97x100 double array
or
out = {tmp.PowerH2COM} % 1x100 cell array of 97x1 double arrays

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by