Solved


Guess Cipher
Guess the formula to transform strings as follows: 'Hello World!' --> 'Ifmmp Xpsme!' 'Can I help you?' --> 'Dbo J ifmq zpv...

13 years ago

Solved


Make a diamond
Given n, odd number > 1, return n by n matrix consist of "null" and "*" characters arranged like a diamond. No toolbox funct...

13 years ago

Answered
adding every element of an array with every element of another array?
Pranav wrote: "...i want to add elemnts of A to be added to every other elemnet of B. ie. 1+[5 6 7 8],2+[5 6 7 8],...so on..." ...

13 years ago | 1

| accepted

Answered
finding the mean for large data
A = rand(3,192); n = 9; s = size(A); out = squeeze(nanmean(reshape([A nan(s(1),mod(-s(2),n))],s(1),n,[]),2)); ...

13 years ago | 0

Answered
Matrix and vector multiplication elementwise
Rica wrote: "...how to calculate: ... C=[a(1,1)*h(1) a(1,1)*h(2) a(1,1)*h(3); a(2,1)*h(1) a(2,1)*h(2) a(2,2);.......;...;a(...

13 years ago | 0

Answered
Write MatLab commands to find the index of the max value in the bold area of A
variant B = -inf(size(A)); B(1:8,3:5) = A(1:8,3:5); [m,n] = find(abs(B - max(B(:))) < eps(100));

13 years ago | 0

Answered
Edit:Value Exceeeds while dividing
[~,i1] = sort(A); B1 = sort(B); [~,i2] = sort(i1); C = B1(i2);

13 years ago | 0

| accepted

Answered
please give correction in code
last 6 rows: r = unique(data); z = nan(numel(r),2); for i1 = 1:numel(r) c = data(data(:,1)==r(i1),2); z...

13 years ago | 0

Answered
if i have a for loop doing iterations based on random intervals of time between .5-5 seconds, how do i keep track of that time?
x = cumsum(.5+4.5*rand(60,1)); or just x = sum(.5+4.5*rand(60,1));

13 years ago | 1

| accepted

Solved


Detect a number and replace with two NaN's
Write code which replaces the number 1 with two NaNs. Example X = [ 1 2 NaN 4 1 3 7 NaN 1 4 NaN 2] ...

13 years ago

Solved


What's Your BMI?
Find the body mass index. For reference, please refer to Wikipedia here: <http://en.wikipedia.org/wiki/Body_mass_index body ...

13 years ago

Solved


Make a 1 hot vector
Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...

13 years ago

Answered
how to replace the values of one matrix to another
f=[ 1 2 5 6 3 4 7 8 9 10 13 14 11 12 15 16] c=[1;1]*(1:8); f2 = permute(reshape(f,[2 2 2 2]),[3 1 4 ...

13 years ago | 0

Answered
Removing repeating data points
A = randi(10,3) B = randi(10,5) A(ismember(A(:),B(:))) = nan

13 years ago | 1

Answered
Set logical array values to true if value n values ahead is true
x = [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0] > 0; n = 2; x(bsxfun(@minus,find(x),(n:-1:1)')) = true;

13 years ago | 0

| accepted

Solved


Given a matrix, return the last eigen value
Given a matrix, return the first eigen value For example: x = magic(5) 17 24 1 8 15 23 5 7 14 ...

13 years ago

Answered
i need to convert a string to a num without using the "str2num" function but in the final answer i have some undesired spaces. how can i remove them?
out = (st-'0')*10.^(numel(st)-1:-1:0)'; or from Cody out = polyval(st-'0',10);

13 years ago | 0

Solved


Exact binary matrix factorization
Given a binary-valued (only ones and zeroes) MxN matrix C, and K (where K<M and K<N) find a binary-valued MxK matrix A and a bin...

13 years ago

Solved


Subtract two positive numbers
Given a and b as a string, return b-a without using string to number conversion functions. a and b must to be a same size and b ...

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

13 years ago

Answered
Finding the position of valaue
[out,out] = ismember(B,A);

13 years ago | 0

Solved


Basics: 'Find the eigenvalues of given matrix
Find the eigenvalues y for a given matrix x.

13 years ago

Answered
All possible combinations of 2 vectors.
variant t = [1 3 5]; ii = perms([t, zeros(size(t))]); out = unique(sort(t(:,1:numel(t)),2),'rows'); or t = [1...

13 years ago | 1

Solved


Unique values without using UNIQUE function
You must return unique values in a vector in *stable* mode without using the unique function. About stable order flag: ...

13 years ago

Solved


Divisors of an integer
Given a number N, return a vector V of all integers that divide N. For example, N = 10 Then V=[1 2 5 10]

13 years ago

Answered
log function for symbol with power
evalin(symengine,'log(a,a^15)') feval(symengine,'log',a,a^15)

13 years ago | 0

Answered
Edit:Replacing 5 bits in Binary value
A=[1056;1078] B=[31;25]; C = decbin(A,11); D = dec2bin(B,4); n = 4; C(:,n : n + size(D,2) - 1) = D

13 years ago | 0

| accepted

Solved


Solving a quadratic equation
Given a, b ​​and c, Return the solution of the following quadratic equation: a*x^2 + b*x + c = 0.

13 years ago

Solved


Add two numbers
Calculate the sum of two numbers. Example input = [2 3] output = 5

13 years ago

Load more