Solved


Return a list sorted by number of occurrences
Given a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x. Ties are resolved by a ...

alrededor de 1 año ago

Solved


Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

alrededor de 1 año ago

Solved


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...

alrededor de 1 año ago

Solved


Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

alrededor de 1 año ago

Solved


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

alrededor de 1 año ago

Solved


Return the first and last character of a string
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

alrededor de 1 año ago

Solved


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 = ...

alrededor de 1 año ago

Solved


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]

alrededor de 1 año ago

Solved


Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

alrededor de 1 año ago

Solved


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.

alrededor de 1 año ago

Solved


Return area of square
Side of square=input=a Area=output=b

alrededor de 1 año ago

Answered
How does one plot only the maximum y value for an x value with multiple y values?
Hi Geoff, After seeing the data you provided im assuming the data set it something like y4=[5 5 4 4 3 3 ...

alrededor de 1 año ago | 0

Answered
How can I write a matlab code for the below mentioned expression?
Hi Anomitra, For the variable 'ne' you could define it as a Np x Np with diagonal elements as 0 and non diagonal elements as 1 ...

alrededor de 1 año ago | 0

| accepted

Answered
Decimal to binary, bit reversal of binary and binary to decimal
I suppose the error has to do with the command 'fliplr' Could you rather try the function 'flipud' X = flipud(b);

alrededor de 1 año ago | 0

Solved


Fill a zeros matrix
The aim is to fill an array of all zeros given a numerical value and the index of row and columns for this value. 3 Inputs: ...

alrededor de 1 año ago

Answered
Error:- Index in position 1 is invalid. Array indices must be positive integers or logical values.
Hi Yash, This could be because of the line irradianceReorder(round(a1),round(b1),round(c1)) = irradiance(i,j,k) + irradianceRe...

alrededor de 1 año ago | 0

Solved


intersection of matrices
Given two matrices filled with ones and zeros, determine if they share a common row, column entry. These matrices are of identi...

alrededor de 1 año ago

Solved


Getting the indices from a matrice
Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

alrededor de 1 año ago

Solved


"mirror" matrix
Create n x 2n "mirror" matrix of this type: Examples For n = 2 m = [ 1 2 2 1 1 2 2 1 ] For n = 3 m = ...

alrededor de 1 año ago

Solved


Create a Multiplication table matrix...
Create a product table in this format: P = [ 1 2 3 4 5; 2 4 6 8 10; 3 6 9 12 15; 4 8 12 1...

alrededor de 1 año ago

Solved


Reindex a vector
You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...

alrededor de 1 año ago

Solved


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 ...

alrededor de 1 año ago

Solved


Return a list sorted by number of consecutive occurrences
Inspired by Problem 38 by Cody Team. Given a vector x, return a vector y of the values in x sorted by the number of CONSECUTIVE...

alrededor de 1 año ago

Solved


Longest run of consecutive numbers
Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

alrededor de 1 año ago

Answered
New to MATLAB so need help with following
You could first declare an array of x element knowing that you need to find value upto X(6) clc clear all close all N=6; %if...

alrededor de 1 año ago | 1

Solved


Subset Sum
Given a vector v of integers and an integer n, return the the indices of v (as a row vector in ascending order) that sum to n. I...

alrededor de 1 año ago

Solved


"Look and say" sequence
What's the next number in this sequence? * [0] * [1 0] * [1 1 1 0] * [3 1 1 0] * [1 3 2 1 1 0] This a variant on the w...

más de 1 año ago

Solved


Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

más de 1 año ago

Solved


Set the array elements whose value is 13 to 0
Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

más de 1 año ago

Solved


Is this triangle right-angled?
Given any three positive numbers a, b, c, return true if the triangle with sides a, b and c is right-angled. Otherwise, return f...

más de 1 año ago

Load more