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

circa un anno 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....

circa un anno 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...

circa un anno ago

Solved

Roll the Dice!

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

circa un anno 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...

circa un anno 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...

circa un anno 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 = ...

circa un anno 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]

circa un anno 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...

circa un anno 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.

circa un anno 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 ...

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

circa un anno 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 ...

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

circa un anno 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);

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);

circa un anno 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: ...

circa un anno 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...

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

circa un anno 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...

circa un anno 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...

circa un anno 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 = ...

circa un anno 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...

circa un anno 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...

circa un anno 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 ...

circa un anno 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...

circa un anno 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 ...

circa un anno 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...

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

circa un anno 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...

circa un anno 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...

circa un anno 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...

circa un anno 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...

circa un anno 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...

circa un anno ago