% Matlab script that performs tasks a,b and c relating to input and menu
% a
% input of day of the week
dayOfWeek = input('Enter day of the week : ','s');
% use strcmpi to compare if input is sunday or saturday (strcmpi
for case
% insensitive comparison)
% weekend
if (strcmpi(dayOfWeek,'Saturday') == 1 ||
strcmpi(dayOfWeek,'Sunday')== 1)
fprintf('Have a nice weekend\n');
else % weekday
fprintf('Good luck in your class lectures and your
studies.\n');
end
%b
% input an array of size 3 rows and 2 columns
array = input('Enter a 3X2 array (eg - [2 4;6 3;5 9]) : ');
% check if user input array is correct and display the message
accordingly
if(size(array,1) == 3 && size(array,2) == 2)
fprintf('You have entered the array correctly\n');
else
fprintf('You have not entered the array correctly\n');
end
%c
% Colors is the header of the menu and Red, Blue, Green and Yellow
are the
% button values (replace the text as given in the selection window)
(as
% screenshot is not provided using sample value)
% create a cell array of button choices for menu
menu_choices = {'Red','Blue','Green','Yellow'};
% display menu and get the index of the button seleced by user in
user_val
user_val = menu('Colors',menu_choices);
% display the string on the button stored in index user_val
fprintf('You selected : %s\n',menu_choices{user_val});
%end of script
Output:


Write a script in MATLAB that prompts the user to do a, b, & c. a.)script...
1) Write a MATLAB script to prompt a user to input two numbers, then assess whether the two numbers are equal or not. If the two numbers are equal, display that they are equal in the Command Window. If they are not equal, display that they are not equal in the Command Window. 2) Write a MATLAB script that prompts the user to enter the day of the week using the input function. If the information the user enters is...
MATLAB
homework assignment (HW6), but this time using a "vectorized" approach. Write a script that prompts the user for N integers (set N-6), one at a time, using a while loop. Error-check to ensure that each number entered is an integer, displaying an error message if it is not. If it is an integer, store it in an array variable nums. Continue prompting until N integers have been successfully entered. (You may copy and paste your code from the previous...
Modular program mathlab: Write a program in Matlab that would continuously ask the user for an input between 1 and 6, which would represent the result of rolling a die. The program would then generate a random integer between 1 and 6 and compare its value to the value entered by user. If the user’s die is larger, it should display, “You got it” If the user’s die is smaller, it should display, “Nice try” If the results are the...
Write a script in matlab that prompts the user to input the day, month, and year; determine the day of the year (the number of days including the current day). Be sure to take leap year into account. Use a for loop Test your code on the following dates: February 28, 2015 April 9, 1976 October 12, 1887 Create a script that performs the same function as repmat. The only built-in commands you may use are input, size, and disp.
8. Write a script that creates an associative or multidimensional array in PHP a. And displays that array in a table b. Create a form with at least two input fields and a Submit button. c. Write a script that will validate that the user entered data in the input fields and that the fields are not blank when the Submit button is pressed d. And returns the values entered in the input field when the Submit button is pressed.
Needs to be solved by a script in MATLAB. Use of if, else, and
ifelse statements are encouraged. My main issue is figuring out
what order to place if statements in. Please comment if any more
info is needed
Create a script file which prompts the user for the water level of the tank pictured below. The tank has a cylindrical base with a height of 25 ft and a diameter of 40 ft. The top of the tank is...
MATLAB QUESTION
8) Create a program that first prompts the user to enter any two numbers. Then prompt the user again to input as many numbers as they choose. Stop the program by inputting-1. Then, display the largest number and second largest number in the command window once the user kills the program. The built-in max function cannot be used. The figure below is an example of what the command window should look like when the code is ran. First...
If statement (c++ program) How do I write a program that prompts the user for what the name of the day is and reports if it is the weekend. Look at the test cases for exact formatting and language user enters S gets weekend user enters t gets weekday
Write a MATLAB script that works like following Program User replies (for instance) Hi Hi What’s your name? John Smith What year were you born? 1995 Does that mean you are 20? Yes What’s your favorite team? Blues Good luck to your Blues. Buy. Buy. Have a nice day.
using matlab, write a script for the following that prompts the user to input the amount of cases bought as a vector, calculates the cost, and stores the correspondind cost in a row beneath the demand: the price of produce is calculated as follows: if 30 cases of oranges are bought, the cost is 4 dollars per case if more than 30, but less than 100 cases are bought, the cost is 10 for the first 30 cases, then 3...