Return elements unique to either input
Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...
Return unique values without sorting
If the input vector A is [42 1 1],
the output value B must be the unique values [42 1]
The values of B are in the same order a...
Specific Element Count
Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_.
Note: NaNs are equal and there may be n...
4年弱 前
解決済み
First non-zero element in each column
For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero i...
4年弱 前
解決済み
Vector creation
Create a vector using square brackets going from 1 to the given value x in steps on 1.
Hint: use increment.
4年弱 前
解決済み
Create a vector
Create a vector from 0 to n by intervals of 2.
4年弱 前
解決済み
Flip the vector from right to left
Flip the vector from right to left.
Examples
x=[1:5], then y=[5 4 3 2 1]
x=[1 4 6], then y=[6 4 1];
Request not ...
4年弱 前
解決済み
Find max
Find the maximum value of a given vector or matrix.
4年弱 前
解決済み
Doubling elements in a vector
Given the vector A, return B in which all numbers in A are doubling. So for:
A = [ 1 5 8 ]
then
B = [ 1 1 5 ...
Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B.
So if
A = [1 2 3;
4 5 6];
...
4年弱 前
解決済み
Reverse the vector
Reverse the vector elements.
Example:
Input x = [1,2,3,4,5,6,7,8,9]
Output y = [9,8,7,6,5,4,3,2,1]
4年弱 前
解決済み
Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example:
[q,r] = swap(5,10)
returns q = ...
4年弱 前
解決済み
Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes.
---
If you want to get a random permutation of integer...
Maximum value in a matrix
Find the maximum value in the given matrix.
For example, if
A = [1 2 3; 4 7 8; 0 9 1];
then the answer is 9.
4年弱 前
解決済み
Roll the Dice!
*Description*
Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice.
*Example*
[x1,x2] =...
4年弱 前
解決済み
Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, s...