フィルターのクリア

Rotating text to 90 degrees

113 ビュー (過去 30 日間)
Ananya
Ananya 2024 年 2 月 16 日
回答済み: Adam Danz 2024 年 2 月 16 日
I want to design an experiment in Psychtoolbox in which the alphabet T is rotated to 90 degrees.
By rotated to 90 degrees, I mean that the alphabet T (vertical) should appear in such a way that the head of the T should be either in the left or right direction.
Here is the code that I made so far but I do not know how to proceed.
% Initialize Psychtoolbox
PsychDefaultSetup(2);
Screen('Preference', 'SkipSyncTests', 1); % Skip sync tests for better compatibility
% Get the screen number
screenNumber = max(Screen('Screens'));
% Open a window
[windowPtr, windowRect] = PsychImaging('OpenWindow', screenNumber, 0); % 0 is black background
% Set text parameters
textSize = 50;
textColor = [255 255 255]; % White color
fontName = 'Arial';
% Define the alphabet 'T'
alphabetT = 'T';

回答 (2 件)

Star Strider
Star Strider 2024 年 2 月 16 日
編集済み: Star Strider 2024 年 2 月 16 日
I’ve never used PsychToolbox, however that would be relatively straightforward in MATLAB graphics —
alphabetT = 'T';
figure
text(0.5, 0.5, alphabetT, 'FontSize',50)
set(gca, 'Visible','off')
figure
text(0.5, 0.5, alphabetT, 'FontSize',50, 'Rotation',90)
set(gca, 'Visible','off')
It might be necessaary to add an axes reference to the text call. See the documentation reference in ax for details.
EDIT — Corrected typographical errors.
.

Adam Danz
Adam Danz 2024 年 2 月 16 日
It looks like you're working with embedded text.
You may find this resource helpful: https://peterscarfe.com/rotatingText.html
It contains a demo for rotating text in psychtoolbox by drawing the text to a texture and then to the screen.

カテゴリ

Help Center および File ExchangeInstallation and Operational Settings についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by