How to make a flowchart of an industrial plant in app designer, where you can add or remove equipment.

조회 수: 9 (최근 30일)
How to make a flowchart of an industrial plant in app designer, where you can add or remove equipment.

답변 (1개)

prabhat kumar sharma
prabhat kumar sharma 2024년 1월 22일
편집: prabhat kumar sharma 2024년 1월 22일
Hi Jhoni,
I understand that you want to know how to create a flow chart in the app designer, but app designer is not the correct tool for creating the flow charts, while it does not have any such functionality but I have seen state flow getting used for the flow chart creation.
Here is the link you can refer to know more how to create flow charts in state flow: https://mathworks.com/help/stateflow/ug/flow-charts-in-stateflow.html
If you are looking for an app design to achieve flow chart so there could be a workaround possible:
  1. Create an ‘mlapp’
  2. Use the axes component to draw static elements of the flowchart that do not change, like pipes or fixed structures. You can use functions like plot, line, or rectangle to draw these elements.
  3. Define a way to represent equipment, such as using images, shapes, or custom drawings. You can use ‘imagesc’, rectangle, or other plotting functions to add these to the axes.
  4. Add buttons or other controls that let users add or remove equipment. When a user interacts with these controls, the corresponding callback functions will update the flowchart. For adding equipment, you might open a dialog to select the type of equipment and then draw it on the axes. For removing equipment, you might let users select an item on the flowchart and then press a button to delete it.
% Callback function for 'Add Equipment' button
function AddEquipmentButtonPushed(app, event)
equipmentType = 'Pump'; % This could be determined through a dialog
x = 10; % X position where the new equipment should be added
y = 20; % Y position where the new equipment should be added
drawEquipment(app, equipmentType, x, y);
end
% Function to draw equipment on the axes (Added a public function)
function drawEquipment(app, equipmentType, x, y)
switch equipmentType
case 'Pump'
% Draw a rectangle or an image representing a pump
rectangle(app.UIAxes, 'Position', [x, y, 10, 10], 'Curvature', [1, 1], 'FaceColor', 'r');
% Add cases for other types of equipment
end
end
% Callback function for 'Remove Equipment' button
function RemoveEquipmentButtonPushed(app, event)
% Implement logic to remove selected equipment from the axes
% This could involve setting up a way to select equipment on click and then deleting the selected object
end
I hope it helps!

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by