What is parseSolution and struct?
1 view (last 30 days)
Show older comments
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 Comment
Eshaan Shah
on 11 Nov 2020
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
Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!