Filter löschen
Filter löschen

How to get screen coordinates of block in Simulink model?

9 Ansichten (letzte 30 Tage)
Nitin
Nitin am 23 Nov. 2012
Beantwortet: Ganesh G am 13 Okt. 2015
I have this requirement where I need to calculate upper right corner points pixel coordinates of any block. For reference, we need to think about these conditions, 1. ModelBrowser is visible or not? -> I can get this flag and even can get width of ModelBrowser 2. ToolBar, StatusBar, ExplorerInfoBar are visible or not? And their height. -> There is flag for ToolBar and StatusBar, but it always return 'on' inspite of Toolbar is not visible. 3. How to get height of Toolbar, StatusBar, ExplorerInfoBar?
I am using following logic but its not working. Any help will be highly appreciated.
blockPOS = get(hBlkHandle, 'position')
ModelPOS = get(hSysHandle, 'location');
isModelBrowserVisible = get(hSysHandle, 'ModelBrowserVisibility');
ModelBrowserWidth = 0;
if strcmp(isModelBrowserVisible,'on')
ModelBrowserWidth = get(hSysHandle, 'ModelBrowserWidth');
end
isToolbarVisible = get(hSysHandle, 'Toolbar');
ToolBarWidth = 0;
if strcmp(isToolbarVisible,'on')
ToolBarWidth = 150; % this is just hardcoded value for testing
end
X = modelPOS(1) + blockPOS(3) + ModelBrowserWidth- 31;
tempY = modelPOS(2) + blockPOS(2)+ToolBarWidth;
screenSize = get(0,'ScreenSize');
Y = screenSize(4) - tempY - dlgHeight;

Antworten (1)

Ganesh G
Ganesh G am 13 Okt. 2015
Try to contact mathworks support team with error details and your Polyspace license. They should be able to investigate it further and point you to the cause of the issue

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by