Question

Problem 1 (6 Points) Create the following variables in the code: Scalar Character (or single letter string) An array of 6x1 A matrix of 2x4 The values could be anything; however, make sure you agree with the variable type the workspace is telling you. You need to have four variables in your workspace after you are done declaring them. Remember that every value (scalar, character, array, or matrix) needs to have a variable name-ans is not an accepted variable name. Rules for variables, do not have spaces in them, and do not start with a number, Note: in the class exercises every line of code finished with a semicolon (). This is done so the result of that line does not come out in the Command Window. A good exercise is to write the four lines of code that this problem requires with the semicolon at the end, and run the code. Then, remove the semicolons of the end of each line, and run the code again. See the difference.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

scalar=2;%scalar variable
Character='q;'%Character variable
Array6_1=[1;2;3;4;5;6];%6x1 array
Matrix2_4=[1 2 3 4;5 6 7 8];%2x4 array

Add a comment
Know the answer?
Add Answer to:
Problem 1 (6 Points) Create the following variables in the code: Scalar Character (or single letter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write in C Spring 2016 Lab Assignment 11 ET2100 In computer programming in general a "string"...

    Write in C Spring 2016 Lab Assignment 11 ET2100 In computer programming in general a "string" is a sequence of characters. In the C language anything within double quotes is a "string constant" so you have been seeing strings all semester. But we can also have string variables. In the C language these are implemented as an array of char, e.g. char name (10]: In order to make these variables easier to work with, it has been universally agreed that...

  • python Problem 3-6 points First, start with the following code: import numpy as np A np.random....

    python Problem 3-6 points First, start with the following code: import numpy as np A np.random. randint (0, 10, sie n,n)) np. savetxt ('exam2.txt', A, fmt-idelimiter B-# np. zeros ( (n, n) , dtypes, int 64, ) When run, it will produce a file named "exam2.txt" that has 5 rows each with 5 numbers separated by commas,. In addition, a 5 by 5 array of zeros named B is defined. Run this code, but do not change it Your job...

  • Program Overview This brief exercise is designed for you to consider how reference variables behave when...

    Program Overview This brief exercise is designed for you to consider how reference variables behave when you are passing them as arguments by-value. Instructions Name your class References.java. 1. Implement the following methods. 1.1 Method name: readStudentNames Purpose: This method accepts an array of strings as a parameter. It loops through the array and asks the user to input names. It populates the array of strings with the names. Parameters: an array of Strings, stringArray Return type: void In the...

  • Given the following problem, explain what instance variables and methods you would create, what parameters would...

    Given the following problem, explain what instance variables and methods you would create, what parameters would be sent to each method (if any) and what values would be returned (if any), and an overview of what the method will do. You should explain why you have chosen to break the problem down as you have. You are required to write a program in JAVA which will fill an array with names entered by the user. You must be able to...

  • You will create a new project. Type in the following program and run it to produce...

    You will create a new project. Type in the following program and run it to produce the output for the program. Good practice in writing a program in any language, including Python, is to add comments for each line and state clearly what is the program input and output. Your program must include comments, so a reader will know exactly what you are trying to do in each line of code and allow for easy maintenance. Beginning a line with...

  • Hi I was hoping to get some help with my code for this problem. I don't...

    Hi I was hoping to get some help with my code for this problem. I don't know how to correctly read a txt file and the difference between using string and cstring. My code is at the bottom please help thanks. 1. Create the following “data.txt” file. Each record consists of customer's name and their balance: Maria Brown 2100.90 Jeffrey Jackson 200.20 Bernard Smith 223.10 Matthew Davenport 1630.20 Kimberly Macias 19100.90 Amber Daniels 2400.40 The records in the file will...

  • FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width,...

    FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width, height (in inches), weight (in pounds), address (1 line), city, state, zip code. These variables must be private. Create setter and getter functions for each of these variables. Also create two constructors for the box class, one default constructor that takes no parameters and sets everything to default values, and one which takes parameters for all of the above. Create a calcShippingPrice function that...

  • can someone please comment through this code to explain me specifically how the variables and arrays...

    can someone please comment through this code to explain me specifically how the variables and arrays are working? I am just learning arrays code is below assignment C++ Programming from Problem Analysis to Program Design by D. S. Malik, 8th ed. Programming Exercise 12 on page 607 Lab9_data.txt Jason, Samantha, Ravi, Sheila, and Ankit are preparing for an upcoming marathon. Each day of the week, they run a certain number of miles and write them into a notebook. At the...

  • Problem 1 In this problem, you will write two functions. The first function takes in a...

    Problem 1 In this problem, you will write two functions. The first function takes in a string and returns that string without any dashes. The second function takes in the first and last name and returns a string that is lastname_firstname and uses the previous function to remove any dashes (-) in the name. Note that you’ll be testing it by calling it from the command line; you’ll call it from a script in problem 3. Deliverables: Function file that...

  • using sql answer the following i need to double check my answers Question 1 Controls the...

    using sql answer the following i need to double check my answers Question 1 Controls the flow of execution based on a condition begin...end try...catch goto if...else 10 points Question 2 Changes the database context to the specified database. set alter exec use 10 points Question 3 Exits the innermost WHILE loop. goto quit return break 10 points Question 4 Controls the flow of execution when an error occurs declare on error goto try...catch continue...error 10 points Question 5 Declares...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT