Réponse apportée
How to delete the duplicate number or using unique in the cell?
A={[3];[6 8 3];[5];[10 5]}; k = repelem((1:numel(A))',cellfun(@numel,A)); B = cell2mat(cellfun(@(x)x(:),A,'un',0)); [a,b] =...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
vectorization of symmetrical matrix with off-diagonal vectors multiplied with 2
k = 2; o = ones(size(H)); Hl = H.*(tril(o,-1)*(k-1) + 1); out = Hl(tril(o)>0); or e = H.*((k-1)*(1-eye(size(H))) + 1); o...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to get the corresponding logic value based on the sum of vector elements
A = [1,1,2,3,5]; my_input = 5; out = []; n = numel(A); ii = 1:n; for jj = 1:n k = nchoosek(ii,jj); r = sum(resh...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to find out the impact of independents variables on dependent variable?
Let A - array of your data (365 x 5) : evapotranspiration, temperature, solar radiation, relative humidity and wind speed c = c...

presque 7 ans il y a | 0

Réponse apportée
Search all elements from from array A in array B and write it workspace
Output = A(ismember(A,B))

presque 7 ans il y a | 0

Réponse apportée
How to pick next value from vectors based on a condition?
m = 5; [value,ii] = max(A(m:end)); index = ii + m - 1;

presque 7 ans il y a | 0

| A accepté

Réponse apportée
Count the same element in a large rows of one column
Let A - your vector (421 x 1): [a,~,c] = unique(A); out = array2table([a, accumarray(c,1)],'v',{'value','times'});

presque 7 ans il y a | 0

Réponse apportée
how to change data from 10 minutes to hour?
In R2016b: T = readtable('data.txt','ReadVariableNames',false,'Format','%q %q %f'); TT = sortrows(timetable(T.Var3,'RowTimes',...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How can i find the all the positions of elements in cell and record them all in an the same cell
f = fopen('data.txt'); str = textscan(f,'%s','delimiter','\n'); fclose(f); str = regexp(str{1},'\w+','match','once'); [a,b,c] ...

presque 7 ans il y a | 0

Réponse apportée
How can i find the sorted indexing of the array
A = [2 9 6 5 8]; n = numel(A); AA = [A;1:n]; swapped = 1; while swapped swapped = 0; for ii = 1:n-1 if AA(1,ii+1...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
how to convert num to string ?
x ={... [22] '22 .8 ' [30] '39 .6 ' [44] [48] '49 .6 ' '50 .8 '}; lo = cellf...

presque 7 ans il y a | 0

Réponse apportée
Matrix Average beside the numbers
M =[ 1 2 3 6 5 4 7 8 9]; X = conv2(M,ones(3),'same')./conv2(ones(3),ones(3),'same');

presque 7 ans il y a | 0

Réponse apportée
How can I mat2cell the array?
out = mat2cell([v{:}],1,[3,3,4,3,3]);

presque 7 ans il y a | 0

Réponse apportée
How to repeat the condition for two matrices having different sizes?
I edited the answer. out = A > B(:,:,mod(0:size(A,3)-1,size(B,3))+1);

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How to concentrate matrices of different row length (same column length) into one matrix by unfolding each of the matrices to the smallest row length conatining numbers not nan
M = struct2cell(H); n = min(cellfun(@(x)find(all(~isnan(x),2),1,'last'),M)); M = cellfun(@(x)reshape(x(1:n,:)',1,[]),M,'un',0)...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How to reset the sequence number for the sequence number in vector?
In your case: [~,~,vec2] = unique(vec);

presque 7 ans il y a | 3

| A accepté

Réponse apportée
How to multiply each element of a matrix by another matrix
Use function kron: >> B = reshape(1:9,3,[]) B = 1 4 7 2 5 8 3 6 9 >> A = 2*[1,1;1...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
simple code for the log computation
X = [1, 2, 3, 5, 6]; M = log10(X);

presque 7 ans il y a | 1

Réponse apportée
select rows satisfying a particular condition
% Let A - your array. [ii,jj,v] = find(A); z = [ii,jj,v]; z = sortrows(z,[1,2]); out = accumarray(z(:,1),z(:,3),[],@(x){fu...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How to find the given index values in a array?
in R2016b T = readtable('Sheet2.xls','ReadVariableNames',0); lo = T{:,2:end} ~= 0 & ~isnan(T{:,2:end}); [ii,~] = find(lo); o...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
Check common elements in two vectors and remove them from both the vectors leaving any duplicate. (Example Inside)
a1 = unique([A(:);B(:)]); s = size(a1); [~,iA] = ismember(A(:),a1); [~,iB] = ismember(B(:),a1); ii = (accumarray(iA,1,s) - a...

presque 7 ans il y a | 0

Réponse apportée
Row index exceeds matrix dimensions
T = array2table(A); m = varfun(@mean,T,'GroupingVariables',1); out = A; [~,~,ii] = unique(A(:,1)); out(:,2:end) = out(:,2:en...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
Using kron to create a large matrix
n = 11; A = [-4 2 0;1 -4 1;0 2 -4]; %main diagonal m = size(A,1); mn = m*n; o1 = ones(mn,1); out = full(spdiags([o1,repma...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
placement of elements from a matrix into another matrix
%{ block of code by Rupsana - initial and final submatrix values and initial matrix A: %} tot_row=5; tot_col=10; left_co...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
A command like "unique" for matrices?
A=[1;2;3]; C=[4;5;6]; M = [repmat(A,2,1);C]; out = reshape(unique(reshape(M,3,[])','rows','stable')',[],1);

presque 7 ans il y a | 1

Réponse apportée
How can i seperate a string in all possible smaller ones without using for loops;.
a = 'ATGCA'; out = cellstr(a((1:end-1)' + [0, 1]));

presque 7 ans il y a | 0

Réponse apportée
How to make faster row-wise Matrix multiplication ?
Just use: out = permute(A,[3,2,1]).*B;

presque 7 ans il y a | 1

| A accepté

Réponse apportée
short programs to subtracts rows from a matrix of n length
Z = squeeze(sqrt(sum((T - permute(X,[3,2,1])).^2,2)));

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How would I put this in a for loop ?
T = 1; % Period Vm = 1; % Voltage amplitude v = {@(t)Vm*sin(4*pi*t/T); @(t)2*Vm*sin(4*pi*t...

presque 7 ans il y a | 0

Réponse apportée
How do I create a random row matrix with some fixed positions?
a = [ 11 3 14]; b = 1:20; c = setdiff(b,a); n = numel(c); out = [a, c(randperm(n))];

presque 7 ans il y a | 0

| A accepté

Charger plus