필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Can somebody solve this error pleaaase?

조회 수: 1 (최근 30일)
LuS
LuS 2015년 8월 8일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi all,
I have been struggling (new in Matlab) since yesterday to solve persistant errors and cannot find a way to 'Make Texture' for multiple images. Here is my experiment:
I want to show a number of images, one by one, every 500 milliseconds and every image should stay on the screen for 500ms. Each image should be repeated 9 times but the whole presentation should be random. That is, I do not want to present 1 to 10 randomly and then repeat that same order. I want all images, repeated 9 or 10 times but with random presentation.
Also, I cannot figure out how to 'Make Texture' for multiple images :-( I really need that Function urgently. Can anybody tell me what is wrong with what I wrote?
Many thanks!!
function X
%Open the screen
Screen('Preference', 'SkipSyncTests', 1);
[wPtr,rect]=Screen('OpenWindow',max(Screen('Screens')), [], [0 0 500 500]);
xCenter=rect(3)/2;
yCenter=rect(4)/2;sca
%set up some vectors with our options
allFiles=dir('C:\Users\X\Desktop\MatlabTutorial\EGItest\*.jpeg');
allNames={allFiles};
images_info=dir(fullfile('C:\Users\X\Desktop\MatlabTutorial\EGItest\*.jpeg'));
numImage=length(images_info);
images=cell(numImage,1);
imagenum=1:18;
thingnum=1:9;
[IMAGENUM, THINGNUM]=ndgrid(imagenum,thingnum);
pair_specs=[IMAGENUM(:), THINGNUM(:)];
randorder=randperm(size(pair_specs,1));
rand_specs=pair_specs(randorder,:);
for K=1:numImage
images{K}=imread(fullfile('C:\Users\X\Desktop\MatlabTutorial\EGItest\*.jpeg', images_info.name));
end
T=repmat(1:numImage, 1, 9);
Trand=T(randperm(length(T)));
for K=1:length(Trand)
ourTexture=Screen('MakeTexture', wPtr, );
Screen('DrawTexture', wPtr, ourTexture,[], ourRect);
stimTime=Screen('Flip', wPtr);
imtool(images{k});
repelem(v,3);
end
%Get size of image (all images the same size in this example)
%imageHeight
%imageWidth
%colorChannels
[imageHeight, imageWidth,colorChannels]=size(0);
%Set up left and right picture locations
gap=100; %distance of pics from center
leftRect=[xCenter-gap-imageWidth, yCenter-imageHeight/2, xCenter+imageHeight/2];
rightRect=[xCenter+gap, yCenter-imageHeight/2, xCenter+gap+imageWidth, yCenter+imageHeight/2];
%loop for 180 trials
for trial=1:180
file_name=dir(strcat('C:\Users\X\Desktop\MatlabTutorial\EGItest\*.jpeg'));
end
%pick a random number 1 or 2
randTextureNum=randi(2);
%pick a random number 1 or 2
randRectNum=randi(2);
end

답변 (1개)

Walter Roberson
Walter Roberson 2015년 8월 8일
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 8월 13일
Screen() is not a Mathworks routine. It could do anything for all we know about it. We have no idea what it does or how it does it or what it is intended to do. You will need to either supply the code for it that you wrote or else tell us where to find the code.
I am not going to try to debug the rest of your code until you fix the file handling as I indicated needed to be done in one of your other threads.

이 질문은 마감되었습니다.

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by