how does "[x,y] = WindowCenter(window)" work

when using [x,y] = WindowCenter(window) to determine the center of the window, what should "window" be?

4 件のコメント

Rik
Rik 2022 年 9 月 1 日
I could not find that function in the Matlab documentation, nor could I easily find a function with this signature on the file exchange. Which function do you mean? Where did you get it from? Does it have any documentation?
Torsten
Torsten 2022 年 9 月 1 日
Haojue Yu
Haojue Yu 2022 年 9 月 1 日
I think it comes from psychtoolbox
function [x,y] = WindowCenter(window)
% USAGE: [x,y] = WindowCenter(window)
% Returns a window's center point.
% History
% 26/03/2001 fwc made based on rectcenter
% 05-02-04 fwc OS X PTB compatible
if nargin~=1
error('Usage: [x,y] = WindowCenter(window)');
end
rect=Screen('Rect',window);
[x,y] = RectCenter(rect);
Haojue Yu
Haojue Yu 2022 年 9 月 1 日
what should I input inside that parenthesis?

サインインしてコメントする。

 採用された回答

Rik
Rik 2022 年 9 月 1 日

0 投票

The documentation for that function is terrible. Let that be a lesson for when you write your own function. This help text is completely inadequate.
Even after reading the documentation for the Screen function, I can only tell you that window must be a window pointer or a screen number:
rect=Screen('Rect', windowPtrOrScreenNumber [, realFBSize=0]);
How you would get a window pointer is a mystery to me. Probably with this:
windowPtrs=Screen('Windows');
As this page says: "Return a vector of windowPtrs, including on- and off-screen windows."

その他の回答 (0 件)

カテゴリ

製品

リリース

R2021b

タグ

質問済み:

2022 年 9 月 1 日

コメント済み:

2022 年 9 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by