Can I run experiments with Matlab Web App?

4 次查看(过去 30 天)
Hi, is it possible to collect data for behavioural experiment (seeing pictures and rating emotional distress) via Matlab Web App? So far I've only seen it used to share graphs and would like to know if it's possible to use it for data collection. Thanks!

回答(1 个)

Aashray
Aashray 2025-6-24
Yes, it is possible to use the MATLAB Web App Server to collect data for a behavioral experiment like in your case, where you want to show images and collect emotional distress ratings.
You can follow the below steps to implement this in App Designer, then deploy it as a web app:
1. Design the App UI in App Designer
Use App Designer to build an interface with:
  • An Axes component to display the stimulus image.
  • A Slider to allow users to provide their rating.
  • A Next button to log the response and move to the next image.
2. Display Images Dynamically
In your callback (“NextButtonPushed”), load and display the next image using:
imshow(imread(imageList{currentImage}), 'Parent', app.UIAxes);
3. Record Participant Ratings
Store each image and corresponding rating in a table or array inside your app:
app.Results(end+1,:) = {imageList{currentImage}, app.Slider.Value};
4. Save Data Server-Side
Once all images are rated, save data with:
writetable(app.Results, 'participant_data.csv'); % Saved on server
All files are saved on the server (Web App Server host machine)
5. Deploy the App to Web App Server
  • Use MATLAB Compiler to package your App Designer app.
  • Deploy it using MATLAB Web App Server.
The following screenshot shows how the ratings are stored in the excel file along with file name.
Here are some references you may find helpful:
  1. How to share web apps: https://www.mathworks.com/help/compiler/deploy-web-apps.html
  2. How to build web apps: https://www.mathworks.com/help/compiler/web-apps.html
  3. A similar problem: https://www.mathworks.com/matlabcentral/answers/1942549-retrieving-data-from-matlab-web-app
You can also refer to the code of app that I have created, attaching it for reference.

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by