Answered
Averaging in a cell array
t1 = ~cellfun('isempty',regexp(data(1,:),'Happy|Romantic|Devotional|Calm')); t2 = ~cellfun('isempty',regexp(data(1,:),'Angr...

12 years ago | 0

| accepted

Answered
Conversion to double from sym is not possible.
td = 5; p0 = 3; m = 5; w = 4; x = @(z)arrayfun(@(t)integral(@(t1)p0*min(t1,td)/td.*sin(w*(t-t1)),0,t)/m/w,z); ...

12 years ago | 0

Answered
Calculating Euclidean distance of pairs of 3D points.
use |Statistics Toolbox|: out = squareform(pdist(Nm)); % here Nm - your matrix [Nx3] one variant without |Statistics Too...

12 years ago | 4

| accepted

Answered
how to delete field in struct in loop?
n1 = fieldnames(A); Aout = rmfield(A,n1(cellfun(@numel,struct2cell(A)) == 2));

12 years ago | 0

| accepted

Answered
Parsing a cell array
temp = permute(cell2mat(permute(Data,[1,3,2])),[3,2,1]);

12 years ago | 0

Answered
Help with average of elements in a matrix
n = 3; s = size(M); out = squeeze(nanmean(reshape([M;nan(mod(-s(1),n),s(2))],n,[],s(2)))); without |nanmean| : s...

12 years ago | 0

| accepted

Answered
computational time nested if commands
us1 = abs(Us(:,1:48)); x = us1(:,[1:30,36:48]); z = us1(:,[31,32,34,35]); p = us1(:,33); l1 = all([bsxfun(@gt,p,2*...

12 years ago | 0

| accepted

Answered
Help with matrix manipulation in matlab
out = squeeze(mean(reshape(M,3,[],size(M,2))));

12 years ago | 0

| accepted

Answered
How do I concatenate N matrices
out = cat(1,data.data);

12 years ago | 0

| accepted

Answered
Match columns containing numbers in two cell arrays.Join the cell arrays.
A - cell array 7886x15; B - cell array 696x29 [l,ii] = ismember([A{:,15}],[B{:,2}]); D = cell(size(A,1),size(B,2)); ...

12 years ago | 0

Answered
how to scramble positions of a matrix?
Aout = B(X,Y)

12 years ago | 0

Answered
How to crop some matrix row
A = randi([0 255],105,41,'uint8'); % your matrix i1 = ceil(size(A,1)/2); out = A(i1 - 20 : i1 + 20,:);

12 years ago | 0

| accepted

Answered
How to evaluate large factorials
syms n subs(n*factorial(n-1),1000)

12 years ago | 5

| accepted

Answered
Eliminating a FOR loop
A = randi(10,5,6); B = randi(10,4,1); [i1,j1] = find(bsxfun(@eq,A,reshape(B,1,1,[]))); out_ij = [i1, rem(j1 - 1,s...

12 years ago | 0

Answered
interpolation on look up table
Use |griddedInterpolant|: A = 1000:500:3000; F = 1:20; M = randi([-100 100],20,5); [X,Y] = ndgrid(F,A); ...

12 years ago | 0

| accepted

Answered
How to make structure from Excel
for ii = 3:-1:1 [d,T] = xlsread('example.xlsx',ii); z = [strtrim(T); num2cell(d,1)]; s(ii) = struct(z{:})...

12 years ago | 0

| accepted

Answered
How to translate the following code from Mathematica to Matlab?
l = 2:10; m = 1:5; idx = bsxfun(@eq,l(:),m(:)'); MatrixForm = idx + 0; k = intersect(l,m); a = 1; b = 1...

12 years ago | 0

Answered
How to convert multiple date formats in a loop?
A={'29/08/2014 14:31' '31:41.0' '31:41.1' '31:41.18' '29/08/2014 18:23' '23:23.0' '23:45.2'}; d = reg...

12 years ago | 2

Answered
Replace values in a matrix with ones from other matrix based on some criteria
i0 = isnan(A); [ii,jj] = find(i0); A(i0) = B(sub2ind(size(B),ii+1,jj));

12 years ago | 0

Answered
Exclude Digits from String using Regexp in MATLAB
regexp(str,'[^\d_\.]*','match') or regexp(str,'[a-zA-Z]*','match')

12 years ago | 0

| accepted

Answered
Challenging Question - Finding mean of specific values of matrix and re-entering
s = size(M); l = true(s); l(2:end-1,2:end-1) = false; l1([1,s(1),numel(M)-[s(1)-1,0]]) = true; l1 = reshape(l1,s);...

12 years ago | 0

Answered
convert day year hour data series with missing data to a serial number
f = fopen('dates1.txt'); c = textscan(f,'%s %s','collectoutput',1); fclose(f); out = datenum(strcat(c{1}(:,1),{'_...

12 years ago | 1

| accepted

Answered
Is it possible to vectorize this loop?
F = kron(all(reshape(F,2,[])),[1 1]);

12 years ago | 0

Answered
Group values in a double & create new matrix according to the groups formed
EDIT v = [0 5 10 15 20 30 40 50 100 150 200 inf]; [~,b] = histc(A,v); out ...

12 years ago | 1

Answered
How to change the elements of a matrix based on row/column numbers?
l=2;r=4;b=3;t=5; P=ones(6,6); P(l:r,7 - (b:t)) = 2;

12 years ago | 0

Answered
Regarding Reshape of matrices and saving all of them in workspace
n=16; D = [0:2^n]'; B = rem(floor(D*pow2(1-n:0)),2); C = zeros(4,4,numel(D)); for ii=1:2^n C(:,:,ii)=reshap...

12 years ago | 0

| accepted

Answered
Substitute blank entries by 1 or 0 in a column of a cell given a condition.
b1 = cell2mat(B(:,[2 1])); [i0,i1] = ismember(b1,A(:,1:2),'rows'); B(i0,10) = num2cell(A(i1(i0),3) > 1);

12 years ago | 1

| accepted

Answered
Problem in string-number concatenation
use cell array A={'a1';'a2';'a3';'a4'}; Z=[190;64;4;5]; out = [A, num2cell(Z)];

12 years ago | 1

| accepted

Answered
creating multiple variables from a vector
EDIT a = [185 186 188 189 192 247 248 249 250 251 252 253 254 255 625 626] ; m = ceil(max(a))+1; k = min(a):15:m;...

12 years ago | 0

Answered
Find row with NaN in it.
X=[2 4 6; 4 5 NaN 3 NaN NaN 5 8 12 3 8 NaN]; с = [3 8 NaN]; z = [X;c]...

12 years ago | 0

Load more