回答済み
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');

約2ヶ月 前 | 0

回答済み
How can I mat2cell the array?
out = mat2cell([v{:}],1,[3,3,4,3,3]);

約2ヶ月 前 | 0

回答済み
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);

約2ヶ月 前 | 1

| 採用済み

回答済み
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)...

約2ヶ月 前 | 1

| 採用済み

回答済み
How to reset the sequence number for the sequence number in vector?
In your case: [~,~,vec2] = unique(vec);

約2ヶ月 前 | 3

| 採用済み

回答済み
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...

約2ヶ月 前 | 0

| 採用済み

回答済み
simple code for the log computation
X = [1, 2, 3, 5, 6]; M = log10(X);

約2ヶ月 前 | 1

回答済み
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...

約2ヶ月 前 | 1

| 採用済み

回答済み
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...

約2ヶ月 前 | 1

| 採用済み

回答済み
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...

約2ヶ月 前 | 0

回答済み
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...

約2ヶ月 前 | 1

| 採用済み

回答済み
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...

約2ヶ月 前 | 0

| 採用済み

回答済み
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...

約2ヶ月 前 | 1

| 採用済み

回答済み
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);

約2ヶ月 前 | 1

回答済み
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]));

約2ヶ月 前 | 0

回答済み
How to make faster row-wise Matrix multiplication ?
Just use: out = permute(A,[3,2,1]).*B;

約2ヶ月 前 | 1

| 採用済み

回答済み
short programs to subtracts rows from a matrix of n length
Z = squeeze(sqrt(sum((T - permute(X,[3,2,1])).^2,2)));

約2ヶ月 前 | 0

| 採用済み

回答済み
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...

約2ヶ月 前 | 0

回答済み
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))];

約2ヶ月 前 | 0

| 採用済み

回答済み
Rearrange matrix and concatenate cells
If your datadimer is table: A = datadimer{:,:}; sZ = 291; [m,n] = size(A); k = m/sZ; out = reshape(permute(reshape(A,sZ,k,n...

約2ヶ月 前 | 0

回答済み
return row index of values greater than 0 to a 3 dimensional array
[ii,jj] = find(A > 0); out = accumarray(ii,jj,[],@(x){sort(x)'}); out{:}

約2ヶ月 前 | 0

回答済み
How to crop matrices at the maximal non-NaN values and then center the data
M = struct2cell(H); n = min(cellfun(@(x)find(any(isnan(x),2),1,'first')-1,M)); for jj = 1:numel(H) H(jj).matrix = H(jj).m...

約2ヶ月 前 | 1

| 採用済み

回答済み
How can I extract the time column of a timetable
variant a = rand(20,6); date1 = datetime(2019,4,19) + hours(cumsum(70*rand(20,1))); TT = array2timetable(a,'RowTimes',date1...

約2ヶ月 前 | 1

| 採用済み

回答済み
combining two text file with 100 equal number of header and body text
z = dir('file*_.txt'); zn = {z.name}; n = numel(zn); c = cell(n,1); for jj = 1:numel(zn) f1 = fopen(zn{jj}); k = t...

2ヶ月 前 | 0

| 採用済み

回答済み
How to assign NaN for empty cells in an array?
Finalanswer = ismember(T.Icnum,moga);

2ヶ月 前 | 1

回答済み
How does Matrix(3002:2001:1999998)=0.4 works?
[ii,jj] = ind2sub([1000,2000],3002:2001:1999998); A = sparse(ii,jj,.4,1000,2000);

2ヶ月 前 | 0

回答済み
Matrix problem with my vectors
theta = (-5:5:25)';%+ n = numel(theta); N = [-0.906 1.43 2.78 4.20 5.03 5.28 -2.49 0.889 4.16 7.71 11.0 7.30 12.7]*4.45; FN_c...

2ヶ月 前 | 0

回答済み
How to subtract a number from a previous one
x = [1;.75;.5;.6]; n = filter(1,[1;1],x); or out = tril(toeplitz(x))*(-1).^(2:numel(x)+1).'; or n = x; for jj = 2:numel(...

2ヶ月 前 | 2

| 採用済み

回答済み
how to adjust the conv filtered data same like origanal data?
con=conv(h,L,'same');

2ヶ月 前 | 0

| 採用済み

回答済み
how to count the number of element in observation and make summation?
K = B.TotalRevenue.*ones(size(B,1),3)/3; [a1,~,c1] = unique(B{:,1:3}); out = table(a1,accumarray(c1,K(:)),'v',{'opals','Revenu...

2ヶ月 前 | 0

| 採用済み

Load more