Answered
How to reshapre a matrix?
A =[... 0.5377 0.7254 0.4889 0.3252 1.8339 -0.0631 1.0347 -0.7549 -2.25...

6 years ago | 1

| accepted

Answered
convert excel date and time to matlab
data = [ 9264 20180104 0.8021 9265 2018...

6 years ago | 0

| accepted

Answered
omit nonzero elemnt in cell
A(cellfun(@(x)numel(x) == 1 && x == 0,A)) = {[]};

6 years ago | 0

| accepted

Answered
Interpolation of matrices corresponding to time vector
Variant with interp1: t = [1, 2, 3]; A = {[1, 1; 1, 1] ,[1, 0.9;0.95, .87] , [1.1, 0.85;0.91, .8]}; tt = [1.2, 2.1, 2.9]; ...

6 years ago | 1

| accepted

Answered
how to fill pre allocated matrix using two columns vectors
xx = 10:10:50; yy = 40:10:80; X = [ 35;43;22]; Y = [75;44;67]; m = numel(xx); n = numel(yy); out = zeros(m,n); x10 = ...

6 years ago | 1

| accepted

Answered
How to find nearby labels?
I =[... 1 1 1 2 3 3 1 1 2 2 3 3 4 4 4 5 5 3 ...

6 years ago | 0

| accepted

Answered
How to extract column and row index and the corresponding value from a matrix?
A = [0 1 4 7 6 0]; out = sortrows([fullfact(size(A)),A(:)]);

6 years ago | 1

Answered
can we check a condition at the end of a loop?
B = sort(repmat(1:8,6,4),2); [m,n] = size(B); for i0 = 1:m while any(~diff(B(i0,:))) B(i0,:) = B(i0,randperm(n))...

6 years ago | 0

Answered
Calculating Means for Blocks of Data from Excel
A = [2 1 2 3 5 8 6 9 4 3 2 3 2 1 4 6 7 8 9 6 3 2]; lo = A(:) >= 4; loo = cumsum([0;diff(lo)==1]).*lo; lo3 = loo > 0; out =...

6 years ago | 0

Answered
How to change 0 to 1 and update a matrix
n = numel(x1); y1 = ~x1; % if MATLAB >= R2016b k = y1.*eye(n); % if MATLAB <= R2016a k = bsxfun(@times,y1,eye(n)); out...

6 years ago | 0

| accepted

Answered
Sort a list of files
data = { 'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -10,00°' 'dantec7100_Ma=01_wait_1000_ Yaw -10,00° Pitch -15,00°'...

6 years ago | 0

| accepted

Answered
Could anyone help me how to shuffle the numbers in each column
[m,n] = size(A); out = zeros(m,n); out([randperm(m) + (0:m-1)*m,randi(m,1,n-m)+m^2]) = A(A~=0);

6 years ago | 0

| accepted

Answered
Vector operations not working correctly
cvPredictions = pval < epsilon;

6 years ago | 0

| accepted

Answered
Replace numbers into a vector starts at the center? Looking for general format
vec =[0 0 0 0 0 ]; vec1 = [1 1 1]; z = pad(join(string(vec1),''),numel(vec),'both','0'); out = z{:} - '0'

6 years ago | 1

Answered
How to delete numbers from cell?
a = {'0,31:1.03 SPEED MEASURED 1 [rpm]' '0,31:1.04 MOTOR SPEED [rpm]' '0,31:1.08 MOTOR TORQUE [%]' '0,31:25.04 T...

6 years ago | 1

Answered
sort 2 matrices for minimum numbers sum and divide them
m = 3; r = [ 1 3 4 5 30]; x = [ 5 8 9 4 78]; out = funt(r,x,3); function out = funt(r,x,m) ad = nan(mod(-numel(r),m),...

6 years ago | 1

Answered
How to reshape and reorder a 5D arrays to 4D arrays?
Let A - your 5D array: k = size(A); out = zeros(k(1:end-1).*[1,1,2,1]); out(:,:,1:2:end,:) = A(:,:,:,:,1); out(:,:,2:2:end,:...

6 years ago | 0

| accepted

Answered
Finding a range in an array
Let A - your array. Anew = A.*(1 - 2*(A >= 20 & A <= 26.5));

6 years ago | 0

Answered
How do I compute impulse response?
You can use the filter function with the coefficients as an input argument.

6 years ago | 0

| accepted

Answered
How to convert 3 hourly data into a 6 hourly data?
In R2016b [m,n,k] = size(A); t = hours(0:3:(k-1)*3); Ar = reshape(A,m,[]); TT = table2timetable(array2table(Ar),'RowTime',t(...

6 years ago | 1

| accepted

Answered
Divide large size matrixes, multiply the small matrixes and sum the results together.
C = sum(A.*B,'all') for MATLAB < R2018b : AB = A.*B; C = sum(AB(:));

6 years ago | 0

Answered
creating a large matrix with a pattern
out = kron(eye(200),[1;1;0;1]); or a = [1;1;0;1;zeros(796,1)]; out = a(mod((1:800)'-(1:4:800),800)+1);

6 years ago | 1

Answered
Select random data from a matrix and replace it
A = [1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0]; p = 4; [ii,jj] = find(A); jjj = accumarray(ii,jj,...

6 years ago | 0

| accepted

Answered
Unable to use a value of type 'cell' as an index.
Use: md = cat(1,m{:}); ... mar1 = eo (md(1,1))^ (eo - 1);

6 years ago | 0

| accepted

Answered
How to convert row and column data into x,y,flag format?
out = [fullfact(size(BW1)),BW1(:)];

6 years ago | 1

Answered
filling a matrix with a loop
out = full(spdiags(ones(400,3),[0,1,3],400,400));

6 years ago | 0

Answered
How to apply a cell array of function handles to an array of double
In your case: out = array_double.*(2:2:6)'; General case: out = arrayfun(@(x,y)cell_array_fuction_handles{x}(y),... ...

6 years ago | 0

| accepted

Answered
Create a matrix with random integers between 1 and 9
[~,ii] = sort(rand(9,1)); out = reshape(ii,3,3);

6 years ago | 0

Answered
Multiplication of 2 3d matrices
FactorRetPf = nansum(TotWeightsPf.*NormClassRetPf,3)'; FactorRetBM = nansum(TotWeightsBM.*NormClassRetBM,3)';

6 years ago | 1

Load more