Code to Extract Value from A Specific Cell during Simulation
1 次查看(过去 30 天)
显示 更早的评论
Hi guys,
I have issues extracting my power output value during simulation. I have this code and the table of Pold from workspace. How do I extract only one value from one of the cells in workspace to be included in my array which I declared as [0;0;0;0]. If I have this many value so I dont know how to assign a value into my array which I need to use for the later part of my code.
if T<=0.05
D = DPold(1);
if T>0.045
Pold(1) = P;
end
elseif T>0.05 && T<=0.1
D = DPold(2);
if T>0.095
Pold(2) = P;
end
elseif T>0.1 && T<=0.15
D = DPold(3);
if T>0.145
Pold(3) = P;
end
elseif T>0.15 && T<=0.2
D = DPold(4);
if T>0.195
Pold(4) = P;
end
1 个评论
KALYAN ACHARJYA
2019-7-17
编辑:KALYAN ACHARJYA
2019-7-17
No Screenshot please. Do attach the code using clip button or paste the code using Alt+Enter
回答(1 个)
Samatha Aleti
2019-7-31
Assuming you are able to access the cell from workspace during the simulation, one of the ways to access the cell element from a cell “C” at “i”th index is using C{i}.
Let the Original Array be “X”. I am assuming that the all the elements in “C” are of same data type. You can now include the cell element in the original array using the small code below:
Store = C{i};
for i =1:numel(Store)
X(end+1) = Store(i);
end
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!