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

  • SEARCH
  • Home
  • 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 8168391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:30:24+00:00 2026-06-06T20:30:24+00:00

I want to make a GUI have a slider, this slider’s value will be

  • 0

I want to make a GUI have a slider, this slider’s value will be used to transmit serial data to PIC microcontroller.

The output value of the slider must be a character or string.

  1. How can I define enter code here variable in matlab gui?

  2. How can I know the type of output value of slider ? (int, char, …)

code:

s=serial('COM7');
slider_value = get(handles.slider3, 'value');
fopen(s);
fprintf(s,'%s',slider_value);
fclose(s)
  • 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-06-06T20:30:25+00:00Added an answer on June 6, 2026 at 8:30 pm

    Useful information: http://www.mathworks.se/help/techdoc/ref/uicontrol_props.html.

    The type of the Value property is the scalar value it currently has. This value will between Min and Max which defaults to 0 and 1, respectively. Did you set these to other values? The scalar value will likely be in double representation so you need to convert to a string:

    Put this in your init-section (a slider that goes from 0 to 100):

    set(handles.slider3, 'Min', 0); %set min to 0 (default)
    set(handles.slider3, 'Max', 100); %set min to 100 (default)
    set(handles.slider3, 'SliderStep', [1 10]);
    

    And this in your callback routine:

    s = serial('COM7');
    slider_value = get(handles.slider3, 'Value');
    fopen(s);
    fprintf(s, '%u', uint32(slider_value));
    fclose(s)
    

    The above is just an example. You should set Min, Max, and SliderStep to what you want. Find the relevant sections in the UIcontrol properties documentation that I link to in the beginning. You should also note that I send the data as an unsigned 32-bit value (not the recast).

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

Sidebar

Related Questions

I want to make a small GUI using Tk in Perl that will have
I want to make a nice simple gui using c++. which have drag and
I want to make a GUI which is dynamic, meaning that the GUI will
I have SmartGit GUI tool for my beanstalk repos. I want to make a
I want to make a GUI for my device to show the value of
I want to make some GUI mockup program for video player, so my idea
I want to make basic gui-tests with the ms ui automation framework, therefore i'm
I want to make a gui for what i explained here C# visual control
I have style sheet with a class name changebackgroundcolor i want make change in
I have some Matlab code and a GUI for it and I want to

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.