Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7406547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:34:30+00:00 2026-05-29T05:34:30+00:00

I have a script this MATLAB script: function semjudge clc; name = input(‘Name: ‘,’s’);

  • 0

I have a script this MATLAB script:

function semjudge

clc;

name = input('Name: ','s');
snum = input('Subject #: ','s');

files = dir(fullfile('pictures','*.png'));
index = randperm(length(files));
picture1 = files(index(1)).name;
picture2 = files(index(2)).name;
image1 = fullfile('pictures',picture1);
image2 = fullfile('pictures',picture2);
subplot(1,2,1); imshow(image1); title(picture1);
subplot(1,2,2); imshow(image2); title(picture2);

uicontrol('Style', 'text',...
        'Position', [200 45 200 20],...
        'String','How related are these pictures?');
uicontrol('Style', 'text',...
        'Position', [50 45 100 20],...
        'String','Unrelated');
uicontrol('Style', 'text',...
        'Position', [450 45 100 20],...
        'String','Closely related');
uicontrol('Style','pushbutton','String','Next Trial',...
        'Position', [250 350 100 20],...
        'Callback','next');

h = uicontrol(gcf,...
   'Style','slider',...
   'Min' ,0,'Max',50, ...
   'Position',[100 20 400 20], ...
   'Value', 25,...
   'SliderStep',[0.02 0.1], ...
   'BackgroundColor',[0.8,0.8,0.8]);

set(gcf, 'WindowButtonMotionFcn', @cb);

lastVal = get(h, 'Value'); 

function cb(s,e)
    if get(h, 'Value') ~= lastVal 
    lastVal = get(h, 'Value'); 
    fprintf('Slider value: %f\n', lastVal); 
    end
end

end

This pulls up two random images from a directory onto the screen, with a scroll bar and instructions to determine the level of relatedness/similarity between the two pictures with a position on the scroll bar. That’s all well and good.

What I want, though, is to set it so that when the “Next Trial” button is pressed, the screen will reset, with two NEW random pictures, and the scroll bar back in the middle. How do I do this? I can’t find any instructions on how to do this online.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:34:31+00:00Added an answer on May 29, 2026 at 5:34 am

    What about something like this:

    uicontrol('Style','pushbutton','String','Next Trial','Position', [250 350 100 20],'Callback','clf; semjudge()');
    

    clf to clear the figure window: http://www.mathworks.de/help/techdoc/ref/clf.html;
    and afterwards your function is simply called again which will than plot into the SAME window!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to write a Matlab script that does this: The input is 2
I have this script loaded on a page: (function() { window.alert('bookmarklet started'); function AjaxSuccess(data,
I have a Matlab script that requires a function in a DLL, and calls
Basically, I have 10 data files and I wrote a MATLAB function to process
I have the following script for importing text files into matlab which include hourly
How can I convert this script into a MATLAB function? clear all; set={AB02XY_1,ZT99ER_1,UI87GP_1}; fileData1
Possible Duplicate: In MATLAB, can I have a script and a function definition in
I have a MATLAB script running two copies of the same function and I
i have script like this. function getContactLastDateOfDeparture(contactId) { $.get( '/transaction/ajaxGetContactLastDateOfDeparture/'+contactId, '', function(data){ alert(data); return
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.