답변 있음
matrix formation from two given matrix
A = [5 10 15 20] ; B = [2 1 4 3] ; C = arrayfun(@(k) A(k)*eye(B(k)),1:numel(A),'un',0) ; result = blkdiag(C{:})

거의 12년 전 | 1

답변 있음
Divide an image into n Sectors
A slightly other approach: Retrieve the indices of the black pixels using FIND [r,c] = find(BW==0) % BW is a 2D array ...

거의 12년 전 | 1

답변 있음
Divide an image into n Sectors
Not tested, and off the top of my head, but something along these lines will do: [hh,ww] = meshgrid(1:height,1:width) ; % i...

거의 12년 전 | 1

| 수락됨

답변 있음
How do I get the minima of a parabola?
Why not solve this analytically? P = polyfit(x,y,2) % fit parabola % vertex is a minimum when P(1) ...

거의 12년 전 | 2

답변 있음
Features (variable) ranking/selection
What do you *exactly* mean "the variable has a weight"?

거의 12년 전 | 0

답변 있음
Averaging Together Every N Columns
Another option: A = rand(16,10000) ; N = 1000 ; szA = size(A) ; B = arrayfun(@(k) mean(A(:,k:min(szA(2),k+N-1)),2)...

거의 12년 전 | 0

답변 있음
How do I gain indices of max values in 2D matrix?
Why sort first? A = [1 4; 6 2; 4 2; 7 3] [maxValues, RowIndex] = max(A,[],1) LinearIndex = sub2ind(size(A),RowIn...

거의 12년 전 | 0

답변 있음
How to set a variable name in a code
*Do not use variable names for variables. It is the content of a variable that should change, not its name!* filename = 'pi...

거의 12년 전 | 0

| 수락됨

답변 있음
Assign each column seperately to each customer.
Why do you want to separate the columns? To access data of a specific customer, just use indexing into your matrix. This will ke...

거의 12년 전 | 0

답변 있음
OR condition in regexp
<http://www.mathworks.nl/matlabcentral/answers/125156-conditional-case-on-strfind Again> , approach this in two steps. First ext...

거의 12년 전 | 0

답변 있음
Conditional case on strfind
Approach this in two steps: Step 1. Convert the strings to a numerical values. This step depends on how the strings are mad...

거의 12년 전 | 0

답변 있음
hello , how can i solve this Puzzle using MATLAB ??
Easy: apple is zero, since apple/3 == apple/2

거의 12년 전 | 0

| 수락됨

답변 있음
Compare/match elements of 2 vector data
A = [11 38 49 84 96 117 157 176 200] B = [10 28 37 48 84 157 175 200] D = abs(bsxfun(@minus, A(:), B(:).')) % f...

거의 12년 전 | 0

| 수락됨

답변 있음
how to detect drowsiness ??
How much effort do you want to put in yourself?

거의 12년 전 | 0

답변 있음
Calculate differences between all values in vector
V = [2 3 1 4] ; D1 = bsxfun(@minus,V(:), V(:).') % square form % another option, only unique combinations, requi...

거의 12년 전 | 2

답변 있음
How to find the element in on boundary or interior?
tf = false(size(a)) tf(2:end-1,2:end-1) = true a(tf) % elements in interior a(~tf) % elements on boundary

거의 12년 전 | 1

| 수락됨

답변 있음
how to detect drowsiness ??
Let him press a button every N seconds. If the timings become to variable …

거의 12년 전 | 0

답변 있음
How to produce data randomly from a given matrix without changing the dimension
Do you want a random *permutation* or a random *<http://en.wikipedia.org/wiki/Derangement derangement>* (i.e., none of the eleme...

거의 12년 전 | 0

답변 있음
Time Crisis! Why is my timer not executing the callback function at the period specified?
Your callback function takes a lot of time to execute, including (many) redundant set operations and prints to the command windo...

거의 12년 전 | 0

답변 있음
How to average the values in the third column with respect to some interval in first column??
[~,idx] = histc(LatitudeValues, 0:2:40) result = accumarray(idx, HeightValues, [], @mean)

거의 12년 전 | 0

| 수락됨

답변 있음
how to return first 5 digits of 6th column in cell array?
C = {'this' 'is' 'a' 'cell' 'array' '2013420134' } V = C{6} % retrieve the 6th cell C{6} = V(1:5) % replace it C{7} =...

거의 12년 전 | 0

답변 있음
search in data structure type
TargetParent = [2 2 2] TF = arrayfun(@(k) isequal(subtree(k).Parent, TargetParent), 1:numel(subtree)) % logical indices ...

거의 12년 전 | 1

| 수락됨

답변 있음
randomly sampling with replacement from a sample.
You can use BOOTSTRP. An example: % data Data = 1:20 ; % 113,000 values in your data Nreps = 5 % 2500 in yo...

거의 12년 전 | 0

답변 있음
re-arranging of columns
No need for concatenation … A = load('mydatafile.txt') % only numbers separated by spaces/tabs A(:,[4 23]) = A(:,[...

거의 12년 전 | 0

답변 있음
Summing the elements of cell arrays for only certain values
[~,~,j] = unique(A(:,1:3)) ; [~,x,k] = unique(reshape(j,[],3),'rows') S = accumarray(k,[A{:,4}]) out = [A(x,1:3) num2...

거의 12년 전 | 0

| 수락됨

답변 있음
Plot data from array
doc bar

거의 12년 전 | 0

답변 있음
loading text file to matrix without delimiters
So each digit is a single value, and spaces are to be replaced with NaN … M = char(textread('example.txt','%s','delimiter...

거의 12년 전 | 0

| 수락됨

답변 있음
if elseif statement operands
f is an array with multiple elements, and f0 is a scalar (single element). The statement " _f < f0_ " returns an array the same ...

거의 12년 전 | 0

답변 있음
sort an array and store them into subarrays
Shorter, with less overhead and more flexible: [~,~,j] = unique(A(:,2)) C = accumarray(j,1:numel(j),[max(j) 1],@(k) {A(k...

거의 12년 전 | 0

답변 있음
how to use inpolygon function
A polygon is defined by its vertices(corner points), being pairs of (x,y) coordinates. In your case, these coordinates are store...

거의 12년 전 | 1

| 수락됨

더 보기