MATLAB User Input Prompt in Functions

In summary, the speaker is working on a program to compare monochrome intensities of two circular objects in a greyscale image, but as a beginner, they don't know how to locate the objects. They are wondering if MATLAB can display the image with a grid to make measuring and inputting the values easier. They also ask for help in detecting the locations of spheres in MATLAB.
  • #1
n1caboose
12
0
I am working on a program that compares the monochrome intensities of two circular objects within a greyscale image. However, because I'm a beginner I don't know how to have my program locate where these objects are. This means I need to manually input the radius and position of each circle to the program as input variables.

It can be rather annoying to have to use another program to figure these variables out. Is it possible to have MATLAB display the image on my screen before the function runs, with a grid overlapping it? If that is possible then it would be much easier to measure these values as well as input them into the program.

Also, if anyone does know how to detect the locations of spheres in MATLAB and can tell me, then that would be much appreciated.

Thanks!
 
Physics news on Phys.org

Related to MATLAB User Input Prompt in Functions

1. How can I create a user input prompt in a MATLAB function?

To create a user input prompt in a MATLAB function, you can use the built-in function "input". This function displays a message to the user and allows them to enter a value, which can then be used in the function's code.

2. Can I customize the user input prompt in a MATLAB function?

Yes, you can customize the user input prompt by including a second argument in the "input" function. This argument can be a string that specifies the prompt message, or it can be a variable that holds the prompt message.

3. How do I specify the type of input I want from the user in a MATLAB function?

You can specify the type of input you want from the user by using the third argument in the "input" function. This argument can be a string that specifies the expected data type, such as 'int' for an integer or 'double' for a decimal number.

4. How can I validate the user input in a MATLAB function?

You can validate the user input by using conditional statements or try-catch blocks in your function's code. For example, you can check if the input is within a certain range or if it meets a specific condition before using it in your function.

5. Can I use the user input from a MATLAB function in other functions or scripts?

Yes, you can use the user input from a MATLAB function in other functions or scripts by assigning it to a variable. This variable can then be passed as an argument to other functions or used in other scripts as needed.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
43K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top