답변 있음
Searching matrix for a particular value and ploting it
A = [1 2 3; 2 1 5; 6 7 5;8 2 1]; [row,col] = find(A == 1); or [row,col] = find(abs(A - 1) < eps(100)); out =...

13년 초과 전 | 0

| 수락됨

답변 있음
How to calculate the distance between one row vector and a matrix??...
[edit] a = bsxfun(@minus,train_data,test_point); out = cellfun(@norm,num2cell(a,2));

13년 초과 전 | 2

답변 있음
Dynamic Matrices in Matlab
[a,b,c] = unique(data(:,1)); d = accumarray(c,data(:,3),[],@(x){sort(x)}); n = cellfun(@numel,d); m = numel(a); out = [a, ...

13년 초과 전 | 1

답변 있음
An easy Array question
DATA= [1; 2; 3; 4; NaN ; 6 ;7 ; NaN]; a = [1;4]; b = [6;7]; d = DATA(~isnan(DATA)); out = mat2cell(d(:),[diff(a)...

13년 초과 전 | 0

답변 있음
Dynamic inline formula variable population
Tranfunction = 'prod(Ain,2)'; fun = inline(obj.TranFunction); NewMatrix = fun(Mat); ADD Tranfunction = '(12.*pro...

13년 초과 전 | 0

| 수락됨

답변 있음
'How to' Matrix
other way: a - your vector - row (eg: [0 0 0 0 1]) n = numel(a); out = a(hankel(1:n,[n,1:n-1])); or out = han...

13년 초과 전 | 0

문제를 풀었습니다


Find max
Find the maximum value of a given vector or matrix.

13년 초과 전

답변 있음
change column in matrix
B = reshape(permute(reshape(A,size(A,1),75,[]),[1 3 2]),size(A,1),[]); or s = size(A,2); B = A(:,bsxfun(@plus,1:75:...

13년 초과 전 | 0

문제를 풀었습니다


Largest Twin Primes
<http://en.wikipedia.org/wiki/Twin_prime Twin primes> are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Giv...

13년 초과 전

답변 있음
How to plot a piecewise defined function?
B1=0; C1=1/2; x0 = -2:.1:2; x=abs(x0); y1=zeros(size(x)); t = [x < 1, x >= 1 & x < 2]; y1(t(:,1)) = 1/6*((12...

13년 초과 전 | 0

답변 있음
How to change matrix dimensions?
M - your 3D array with size < 10000,35,12 > out = reshape(permute(M, [1 3 2]),size(M,1),[]);

13년 초과 전 | 0

답변 있음
how can i store all simulation results from gibbs sampling VERTICALLY?
b = kron((1:3)',ones(3));

13년 초과 전 | 0

문제를 풀었습니다


Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
Given a number _n_, return the terminal value of the number chain formed by summing the square of the digits. According to the P...

13년 초과 전

답변 있음
How to convert daily data to monthly?
one way M - your data matrix with 4 columns < Year Month Day data > - double type [a,~,c] = unique(M(:,1:2),'rows'); ...

13년 초과 전 | 3

답변 있음
How can I add NaNs to a cell array in positions that match the positions of NaNs in a separate matrix?
B(isnan(A)) = {NaN}

13년 초과 전 | 0

| 수락됨

문제를 풀었습니다


Test if two numbers have the same digits
Given two integers _x1_ and _x2_, return |true| if the numbers written with no leading zeros contain the same digits. That is, t...

13년 초과 전

문제를 풀었습니다


Television Screen Dimensions
Given a width to height ratio of a TV screen given as _w_ and _h_ as well as the diagonal length of the television _l_, return t...

13년 초과 전

문제를 풀었습니다


The Dark Side of the Die
It is well-known that opposite sides of a classic hexahedral die add to 7. Given a vector of dice rolls, calculate the sum of th...

13년 초과 전

답변 있음
How can I find a correlation between two matrices
one way: out = corr( cell2mat(cellfun(@(x1)interp1(x1,linspace(1,size(x,1),size(y,1))),num2cell(x,1),'un',0)),y);

13년 초과 전 | 0

문제를 풀었습니다


Increment a number, given its digits
Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

13년 초과 전

문제를 풀었습니다


Multiples of a Number in a Given Range
Given an integer factor _f_ and a range defined by _xlow_ and _xhigh_ inclusive, return a vector of the multiples of _f_ that fa...

13년 초과 전

문제를 풀었습니다


Create a random vector of integers with given sum
Your task today is to write a function that returns a vector of integer numbers, between, and including, 1 and m, of which the s...

13년 초과 전

문제를 풀었습니다


Create a random logical vector of N elements of which M are true.
Your task for tomorrow is to create a random binary (logical) vector of N elements of which M are true. For example: ran...

13년 초과 전

문제를 풀었습니다


give nth decimal place of pi
max 15th place after the decimal point is ok for now

13년 초과 전

문제를 풀었습니다


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

13년 초과 전

문제를 풀었습니다


Rank of magic square (for beginners)
Compute the rank r of a magic square of order n WITHOUT rank and magic functions.

13년 초과 전

문제를 풀었습니다


Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

13년 초과 전

문제를 풀었습니다


Right and wrong
Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

13년 초과 전

답변 있음
how to save values in matfile as array
Elysi wrote: " ...stats = [ statmat1 statmat2 statmat3 ......... statmat24 statmat25 statmat26];..." out = reshape(stats,...

13년 초과 전 | 0

| 수락됨

답변 있음
What can I use for equality test between input arguments of type cell?
use if strcmp(Normal{i},Patient_ID{j}) try variant of solution [num, txt] = xlsread('ExcelMainExport_ALL.xls'); ...

13년 초과 전 | 0

| 수락됨

더 보기