Beantwortet
function that combines sub matrices into one matrix
>> your_function = @(m,n)repelem([0, 1; 2, 3],m,n) your_function = function_handle with value: @(m,n)repelem([0...

mehr als 8 Jahre vor | 1

Beantwortet
How can I search for a specific Matrix in a greater Matrix?
Let A - your logical array (600 x 600): x = [0, 0, 0; 0, 1, 1; 0, 1, 1]; out = filter2(x,A) == sum(x(:)) & filter2(~x,~A...

mehr als 8 Jahre vor | 0

Beantwortet
replace part of matrix to another matrix
In your case (without loop) k = cat(3,A,B,D,C); [m,n,q] = size(k); a = full(gallery('tridiag',q*m/2+1,1,1,1)); ii ...

mehr als 8 Jahre vor | 0

Beantwortet
Error message on if functions with two arrays
wi1 = zeros (N,1); for ii=2:N if roi1(ii-1)~= roi1(ii) && roi1(ii)== buobem(ii) wi1(ii) = 1; e...

mehr als 8 Jahre vor | 1

Beantwortet
Closest value in an array, and how to correctly look it up afterwards
[~,ii] = min(abs(permute(x,[2,3,1]) - y(:)'),[],3); search_x = x(size(x,1)*(0:size(x,2)-1)' + ii);

mehr als 8 Jahre vor | 1

Beantwortet
Removing duplicate elements & choose maximum row value of matrix
[~,~,c] = unique(A(:,end),'stable'); out = A(accumarray(c,(1:size(A,1))',[],@(x)x(max(A(x,4)) == A(x,4))),:);

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
selection of data from matrix
data = randi([-41 78],100,5); ii = randperm(size(data,1)); k = [5 4 10]; out = mat2cell(data(ii(1:sum(k)),:),k,size...

mehr als 8 Jahre vor | 0

| akzeptiert

Gelöst


radius of a spherical planet
You just measured its surface area, that is the input.

mehr als 8 Jahre vor

Beantwortet
How count the number of occurence beyond a threshoold value in a matrix
sum(a(:)>255)

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Hello to everyone! Can anyboly help me to this?
A = sortrows(A,1:6); C = {cr_n;cr_p;rc_n;rc_p}; k = numel(C); Tout = cell(k,1); for i0 = 1:k B = sortro...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
How do I get the maximum value of specific columns
out = max(your_matrix(:,2:2:10));

mehr als 8 Jahre vor | 4

| akzeptiert

Beantwortet
Generate vector from cycle for
Variants without use loops day1 = mean(reshape(Gen,86400,[])); or day1 = accumarray(ceil((1:numel(Gen))'/86400),Gen...

mehr als 8 Jahre vor | 0

Beantwortet
Run every element through a function and return a new array
a = 3; b = 4; T_out = rowfun(@(x)a*x+b-1,T,'OutputV','data');

mehr als 8 Jahre vor | 4

Beantwortet
How can I search for a string in a cell array of varying lengths?
x = string('anna'); groups = {{'olivia', 'anna'}; {'john', 'woo'};... {'olivia',...

mehr als 8 Jahre vor | 1

Beantwortet
get common rows from 2 matrices
C = intersect(A,B,'rows')

mehr als 8 Jahre vor | 2

| akzeptiert

Beantwortet
Table data grouping, ordering and recording duplicates
vn = {'ID1' 'ID2' 'Name' 'Date'}; c = {'1b11' 'g121' 'John' '1/1/2015' '1b11' 'g121...

mehr als 8 Jahre vor | 0

Beantwortet
Am trying to reduce a vector by summing some elements in the vector to form another vecter
b = cumsum(hankel(v)); k = max(b .* (b <= 40)); N = k(cumsum(k) <= b(end,1)); or t = cumsum(hankel(v)); t = ...

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
Evaluation of function handle matrix erases values
>> f = @(x,y) reshape([x(:)';zeros(1,numel(x))],[],1); >> f([1,1],[1,1]) ans = 1 0 1 0 ...

mehr als 8 Jahre vor | 0

Beantwortet
How to use MESHGRID or NDGRID instead of multiple FOR-Loop?
a = cell(6,1); [a{end:-1:1}] = ndgrid(0:.5:1); a = cellfun(@(x)x(:),a,'un',0); a = [a{:}]; And rewrite your functi...

mehr als 8 Jahre vor | 2

Beantwortet
Form a Cumulative sum matrix
z = cumsum(S + 2*R) - [R(1:end-1,:); zeros(1,size(R,2))];

mehr als 8 Jahre vor | 0

Beantwortet
three variable together in one loop in different size
n = numel(AA); abc = [AA(:), BB(:), reshape(CC,n,[])']; ii = fullfact([1 1]*n); X = abc(bsxfun(@plus, ii(:,[2 ones(1,...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Matrix with repeated rows of other matrix
for older MATLAB (MATLAB < R2015a) A=[1,2,3,4; 2,3,4,5; 3,4,5,6]; B= [1,2,3]; ii = cumsum(B); i1 = z...

mehr als 8 Jahre vor | 2

Beantwortet
How to get a new cell array containing the repeated elements in an original cell?
[g,val] = findgroups(celloriginal); out = val(histcounts(g,1:max(g)+1)>1); or [a,~,c] = unique(celloriginal); ou...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
How Do I Find the Integral of a Function from One Variable to Another?
>> integrfn(4,-9,17) ans = 2.9018 here function b=integrfn(A,x1,x2) y= @(x)A*exp(-x.^2).*cos(2*x)./(1+...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
How can I find the maximum of a given matrix and then locate the minimum value along the row of the maximum value
[v_max,jj] = max(max(a,[],2)); out_min = min(a(jj,:)); or [ii,~] = find(max(a(:))==a); out = min(a(ii,:));

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
i need to find the roots of the polynomial
in my MATLAB: >> format longg >> p=[1 8 22 24 9]; roots(p) ans = -3.00000009061347 + ...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Need help removing this for loop
[k,m,n] = size(Cp); A = Cp((1:k)' + k*(permute(Tr,[3 1 2]) - 1)+reshape(0:n-1,1,1,[])*k*m);

mehr als 8 Jahre vor | 0

Beantwortet
two variable in same For loop
cb = [AA(:),BB(:),CC(:)]; ii = fullfact([3 3]); out = [cb(ii(:,2),1),cb(ii(:,1),2:end)];

mehr als 8 Jahre vor | 0

| akzeptiert

Mehr laden