Answered
How can I make a smaller matrices from a bigger matrix?
A = B(C,C);

13 years ago | 0

| accepted

Answered
store vectors in matrix over for loop
x1s=(1:3)'; x2s=(10:10:30)'; [ii jj]=ndgrid(x1s,x2s); overnested = arrayfun(@(x,y)[x y],ii,jj,'un',0); or ...

13 years ago | 0

| accepted

Answered
regriding an irregular matrix
If you have data as text file - |yourdata.txt| (eg): 2Jan2002 40 65 6Jan2002 45 22 8Jan2002 43 45 8Jan2002 49 ...

13 years ago | 0

| accepted

Answered
Eliminate rows of cell array outside of a range
final2{1} = final2{1}(final2{1}(:,1)>-7 & final2{1}(:,1)<-6 ,:)

13 years ago | 0

Answered
Merging columns within a single matrix
A(:,[1;3])

13 years ago | 0

| accepted

Answered
i've a matrix of 6x4 and i want to count the rows how many times it occur in a matrix
A=[ 12 45 67 89 34 56 78 65 12 45 67 89 53 55 21 90 12 45 67 89 53 55 21 90 ]; ...

13 years ago | 3

Answered
How to find compare unequal size matrices and create new matrix by combining them??
ii = ismember(Y(:,1:4),X(:,1:4),'rows'); M = [Y(:,1:4),nan(size(Y,1),3)]; M(ii,5:end) = X(:,5:end);

13 years ago | 1

| accepted

Answered
Averaging every n step column and m step row
Z = randi([14 66],108,8); % eg mns = ndgrid(1:12,2004:2012); [ln,ln] = ndgrid(1:numel(mns),1:8); Zout=accumarray(...

13 years ago | 1

Answered
How can I find the indices of the 3 largest values in my matrix?
A = [99 45 93 64; 12 83 24 85 39 71 29 13]; [ii,ii] = sort(A(:),'descend'); out = ii(1:3);

13 years ago | 0

| accepted

Answered
Integration of piecewise function with integral
function J = R(f,x,m) t = x >= 20; p = zeros(numel(x),1); p(t) = x(t) - 20; J = arrayfun(@(x,y)integral(@(t)f(t,m)...

13 years ago | 0

Answered
Find a range of minimum values in a vector/array
I see two ways: 1) out = sort(yourarray); out = out(1:3); 2) [ii,ii] = min(conv(yourarray,[1 1 1],'same')); ...

13 years ago | 0

| accepted

Answered
How to obtain the filtered Index of Cell Array
AllNames= {'A.1';'A.1';'A.10';'A.10';'A.10';'A.10';'A.15';'A.15';'A.16' ;'A.17';'A.17';'A.17';'A.17';'A.17';'A.20A' ;'A.20A';'...

13 years ago | 0

Answered
combine variables into a multi column text file
use cell arrays: row = [ 125 421]; col =[ 651 876]; name = { 'point_1' 'point_2'}...

13 years ago | 0

Answered
How to read cell range from one cell in file
raw(2,3) = {3:4, 6:10};

13 years ago | 0

Solved


Generate binary combinations for a given number of bit(s)
Generate the binary combination as in the example below. Example: If you are given: bin_comb(2) The answer will be: ...

13 years ago

Solved


Remove entire row and column in the matrix containing the input values
Remove the entire row and column from the matrix containing specific values. The specified value can be a scalar or a vector. Fo...

13 years ago

Answered
Take mininum over only two dimensions of 4-d array
a = randi(10,4,5,2,3); % eg s = size(a); a1 = reshape(a,s(1),s(2),[]); [m1,i1] = min(a1,[],3); k = mod(i1-1,s(...

13 years ago | 0

Answered
function that gives the number of letters in a word
length(w{1}) ; out = cellfun('length',w);

13 years ago | 2

Answered
how to find the index of first n occurrence of each unique value of a matrix
A = randi(8,20,1); % eg n = 4; A1 = unique(A) na = numel(A1); out = [A1(:).';nan(n,na)]; for j1 = 1:na ...

13 years ago | 0

Answered
Repeat each page of 3d matrix 24 times
out = totmelt( :,:,kron(1:size(totmelt,2), ones(1,24)) );

13 years ago | 1

Answered
How do I exclude zeros from a matrix?
s = size(A); A1 = zeros(s); for j1 = 1:s(1) A1(j1,1:nnz(A(j1,:))) = nonzeros(A(j1,:)); end other variant: ...

13 years ago | 0

| accepted

Answered
Find a vector of string in a Cell array
[~,i1] = ismember(Dataset,uniquevalue); index = find(all(diff(i1,1,2)==1,2)); other variant: Dataset = { 'DICL' ...

13 years ago | 1

| accepted

Answered
Loop for nested matrix multiplication
eg: A = randi(4,155,3); B = randi(8,455,3);% your matrices A and B one variant; s = size(A); C = zeros(s); ...

13 years ago | 0

| accepted

Answered
How can I solve this question
syms x out = prod(x - solve(x^3-3*x^2+x+5))

13 years ago | 0

Answered
Selecting the most repeated value
out = b((max(a) == a));

13 years ago | 0

Answered
Using a Nested For Loop with input from an Array to Create an Array
ii = (1:100)'; mancof = sf/E*(2*ii).^b + ef*(2*ii).^c - t; Fatigue_Life = find(mancof > 0); ADD after Luke's comment ...

13 years ago | 0

| accepted

Answered
Can someone help me with symbolic differentiation?
TempVar2 = jacobian(Phi,Var);

13 years ago | 0

Answered
The elements of a mxn matrix are the results of m*n matrices. how to do it?
w = cell(6); for i1 = 1:6 for j1 = 1:6 w{i1,j1} = eval(sprintf('matrix_%d%d',i1,j1)); end end

13 years ago | 1

| accepted

Answered
Inverse of a covariance matrix (loop)
Try this is code: d = [19261103; 20121231]; ddte = datenum(num2str(d),'yyyymmdd'); ndte = (ddte(1):ddte(2))'; t ...

13 years ago | 0

| accepted

Answered
how to convert numstrng to integers and take lcm
Try this: out2 = [ 1 0 0 1 0 1 1 1 1 1 0 1 1 1 0 1...

13 years ago | 0

| accepted

Load more