Answered
Problem with ismember function
Use <http://se.mathworks.com/help/matlab/ref/ismembertol.html |ismembertol|>.

9 years ago | 3

| accepted

Answered
How can I apply arrayfun with 2D matrix inputs?
B = permute(A,[2,3,1]); eye3 = eye(3); for jj = 1:size(B,3) B(:,:,jj) = B(:,:,jj)\eye3; end B = permute(B,[...

9 years ago | 0

| accepted

Answered
How to count the time interval at which a particular number occurs in matrix
out = a(diff([0;a(:)])~=0); or x = 999; t = a ~= x; out = a(t | [1,t(1:end-1)]);

9 years ago | 0

Answered
How can I abbreviate this code?
% Let data -> double array [2500 x 3] n = 5; [k0,m] = size(data); k = k0/m; p = permute(reshape(data,n,[],...

9 years ago | 1

Answered
normalization 0 and 1 in matlab imported from excel just for one row
a = [3 4 1 2 3 5 4]; norm_a = (a - min(a))/(max(a) - min(a))

9 years ago | 1

| accepted

Answered
How to overwrite pars of a cell array?
k = ['full' 'zero' 'zero' 'zero' 'zero' 'zero' 'zero' 'zero' 'zero']; out = circshift(k,8);

9 years ago | 0

Answered
Avoiding for loop with ismember
[Fixed] N = 15; c = randperm(N,4); c1 = sort(c(:)); cc = reshape(bsxfun(@plus,N*(c1 - 1),c1')',[],1); or ...

9 years ago | 1

| accepted

Answered
How to extract multiple matrices of different dimensions from a large matrix?
*[Small fix]* % Let A - your matrix [110848 x 15] t = [0;time(1:8)]; t2 = seconds(milliseconds(A(:,1))); ii ...

9 years ago | 1

| accepted

Answered
How do I convert an array into a set of indices using colon notation?
[m, n, k, ~] = size(Matrix1); [d,c,b,a] = ndgrid(1:3,1:k,1:n,1:m); ii = sub2ind([m,n,k,3],a(:),b(:),c(:),d(:)); out =...

9 years ago | 0

Answered
delete elements from a cell array
regexprep(b,'[$#@]|\<https:/+\S*\>','')

9 years ago | 2

| accepted

Answered
Convert array of comma separated strings in cells to matrix
Arr = { '0,2,3' '1,4,5' '2,6,7' }; T = regexprep(Arr,',',''); Brr = cell2mat(arrayfun(@(x)T{x}-'0',(1:numel(...

9 years ago | 0

Answered
How to find row values?
for 2d arrays a = [3 2 1; -5 0 6; 0 0 7]; [~,c] = max(max(a)); b = a(:,c)

9 years ago | 1

Answered
How to insert missing dates for forenoon(F) and afternoon(A)?
T = readtable('datafile0.xls','Sheet', 2); H = hours([12;0]); [g,ii] = findgroups(T.SMD11_DATE); T.SMD11_DATE = []; ...

9 years ago | 0

| accepted

Answered
Extract X number of elements in 3D matrix based on another matrix
A=randi(10,3,3,5); B=[NaN 2 1; 2 NaN 2;NaN 4 3]; [m,n,k] = size(A); B(isnan(B)) = 0; out = permute(reshape((1...

9 years ago | 0

| accepted

Answered
Circshift an ND array by values in an (N-1)D array w/out for loop
A = reshape(1:24,[2 3 4]); b = [1 -1 -3 -1 -1 0]; [m,n,k]= size(A); A1 = reshape(A,[],k); ...

9 years ago | 1

| accepted

Answered
Finding the angle of inclination from two end points of a line.
point1 = [22, -114]; point2 = [693, -233]; x1 = point1(1); y1 = point1(2); x2 = point2(1); y2 = point2(2); s...

9 years ago | 2

| accepted

Answered
If I start with a matrix of zeros, how can I easily create a triangle of ones in that matrix?
N = 1000; T = tril(ones(N)) ; a = round(imresize([flip(T,2),T],[round(N/2*tan(pi/3)) N])); imagesc(a)

9 years ago | 2

Answered
How to find numbers following repeating sequence in an array and number of times it occured
for ii = 2:numel(A) B = hankel(A(1:ii),A(ii:end)); [a,~,c] = unique(B,'rows'); co = accumarray(c,1); ...

9 years ago | 1

Answered
table maximum value column
A=[0 0 0 0 0.0100000000000000 0 0.0100000000000000 1 0.0100000000000000 2 0.0200000000000000 0 0.02000000000...

9 years ago | 0

| accepted

Answered
Finding maximum y value for the same x values and corresponding z values
T = table(x,y,z,'Va',{'x','y','z'}); out = varfun(@max,T,'gr','x'); or z=[... 1 9 7 8 6 5 3 ...

9 years ago | 1

Answered
Calculate mean of columns for a unique value of column variable?
[g,ii] = findgroups(A(1,:)'); out = [ii,splitapply(@mean,A(2:3,:)',g)]'; or [ii,jj] = ndgrid(A(1,:),1:2); out =...

9 years ago | 0

Answered
How do I manipulate data from a csv datafile containing date, time and number data?
f = fopen('Input Data.csv'); c = textscan(f,'%s %s %f','delimiter',','); fclose(f); TT = timetable(datetime(strcat(c{...

9 years ago | 1

| accepted

Answered
Store Data in Cell-Array
variant for MATLAB R2016b and later out = num2cell(C2(find(strcmp(C2,'test')) + (1:5)),2) MATLAB R2016a and earlier: ...

9 years ago | 0

Answered
How to replace value of elements from another matrix index while keeping the same original index?
STAL = [1 3; 2 7; 3 6; 4 2; 5 2; 6 1; 7 4; 8 7]; C = [0 4 1 0]; Tr = 3; New_C = C; [lo,ii] = ismember(C(:),STA...

9 years ago | 0

| accepted

Answered
Compare values in cell array with a threshold value.
% input A= {[NaN,1.8,3,NaN,4];[2.6,NaN,NaN,2.9,4];[NaN,3,2,2,NaN]}; Thresh=10; B = arrayfun(@(x)num2cell(randi([0 23]...

9 years ago | 0

| accepted

Answered
How to use str2num in this problem? (problem is in description)
BS = bit_str{1}-'0' Hie = fft(BS);

9 years ago | 0

| accepted

Answered
Truncating vector to longest continuous string of numbers
m=[ 1 2 3 4 5 6 -5 -5 -5 1 2 3 4 5 6 7 -5 -5 -5 -5 1 2 3 4]; z = diff(m) == 1; z = [z(1);z(:)]; z(diff(z)==1) = 1...

9 years ago | 1

Load more