Hello I trying to know some code.
model.Plants.PZ{1}={[210 240],[350 380]};
model.Plants.PZ{2}={[90 110],[140 160]};
model.Plants.PZ{3}={[150 170],[210 240]};
model.Plants.PZ{4}={[80 90],[110 120]};
model.Plants.PZ{5}={[90 110],[140 150]};
model.Plants.PZ{6}={[75 85],[100 105]};
PZ = model.Plants.PZ;
nPlant = 6
for i = 1:nPlant
for j = 1:numel(PZ{i})
.....
I have a few questions.
1. what is ParseSolution ? Anybody know?
2. the model.Plants.PZ code
>> PZ = model.Plants.PZ
PZ =
1x6 cell array
{1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} why this result didn't respond that numbers (210 240 ,350 380 etc)?
3. How do I know numel(PZ{i})?
I tried to calculate. but
this
Error using numel
Bad subscribing index.
PLEASE HELP ME

댓글 수: 1

1. Not sure what ParseSoultion is.
2. PZ is a 1x6 cell array where each cell contains 1x2 cell array, which ultimately contains the arrays. You can access the arrays like
PZ{1}{1} % 210 240
PZ{1}{2} % 350 380
PZ{2}{1} % 90 110
PZ{2}{2} % 140 160
3. The follwing code executes without any error
model.Plants.PZ{1}={[210 240],[350 380]};
model.Plants.PZ{2}={[90 110],[140 160]};
model.Plants.PZ{3}={[150 170],[210 240]};
model.Plants.PZ{4}={[80 90],[110 120]};
model.Plants.PZ{5}={[90 110],[140 150]};
model.Plants.PZ{6}={[75 85],[100 105]};
PZ = model.Plants.PZ;
nPlant = 6;
for i = 1:nPlant
for j = 1:numel(PZ{i})
disp(PZ{i}{j})
end
end
% Display looks like
210 240
350 380
90 110
140 160
150 170
210 240
80 90
110 120
90 110
140 150
75 85
100 105

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2020년 10월 20일

댓글:

2020년 11월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by