Beantwortet
extract the information from a matrix with three columns
*_EDIT_* load('y.mat'); [yy,i0] = unique([y(:,1:2);y(:,[2 1])],'rows'); y3 = repmat(y(:,3),2,1); y3 = y3(i0); [...

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
Can I have a code that detects # of element transitions and return a matrix that has only rows of minimum element transitions?
_...row 2, 3 , 4 are compared to 1 then row 3, 4 compared to 2 and so on..._ C = squeeze(sum(bsxfun(@minus,A,permute(A,...

fast 10 Jahre vor | 0

Beantwortet
nearest value but bigger nearest
k = bsxfun(@minus,A(:)',B(:)); k(k >= 0) = -inf; [~,ii] = max(k); ii(all(k == -inf)) = 0;

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
Find the indices of elements of matrix that were multiplied
A =[ 8 1 6 3 5 7 4 9 2]; n = 2; s = size(A); B = real(exp(conv2(log...

fast 10 Jahre vor | 1

Beantwortet
Sum of nonzero vector elements
v= [1 2 3 0 0 0 4 5 0 6 7 0 8 9]; b = bwlabel(v(:)); [a,ii] = unique(b,'first'); indx = ii(a ~= 0); t = b ~= 0...

fast 10 Jahre vor | 1

Beantwortet
converting string to double
'1234' - '0'

fast 10 Jahre vor | 2

Beantwortet
problem with sorting a structure
images=dir('file*.tif'); n = {images.name}'; [~,ii] = sort(str2double(regexp(n,'(?<=file)\d*(?=\.txt)','match','once')))...

fast 10 Jahre vor | 1

| akzeptiert

Beantwortet
Matrix A & B need to be merged, Can I delete a complete raw if one appears in both matrices and same column position?
Hi friends! Please my small contribution: jj = reshape(permute(... bsxfun(@plus,permute(A,[3,2,1]),B),.....

fast 10 Jahre vor | 1

Beantwortet
how to use for loops command to ignore 10 times the same code?
[NUMERIC,TXT]=xlsread('whole10L22.xlsx'); x= NUMERIC(:,1); y = NUMERIC(:,2); Mag = NUMERIC(:,3); date_num = datenu...

fast 10 Jahre vor | 2

| akzeptiert

Beantwortet
3D matrix time 2D matrix
Let your |gamma| -> |gamma1| (because |gamma| - name of the function from MATLAB) s = size(relu); M = s(1) * s(2); N ...

fast 10 Jahre vor | 2

| akzeptiert

Beantwortet
How to rewrite a conditional recursive funtion without for-loop
Hi Pascal! Please only with |for-end| loop: nn = [n1,n2,n3]; % nn = randi([0 10],20,3); t = all(nn > 0,2); nn(:,3)...

fast 10 Jahre vor | 0

Beantwortet
How to add data in a matrice?
without loop: F = reshape(1:32,4,[])';

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
summing logicals i times where i is taken from a matrix of integers
*_EDIT_* crit = 0.395; z = max(R(:)); n0 = numel(R); s = size(R); Lo = crit >= rand([s,z]); ii = reshape...

fast 10 Jahre vor | 1

| akzeptiert

Beantwortet
find a value and following values in a matrix
out = (cumsum(A == 23,2)>0).*A

fast 10 Jahre vor | 1

| akzeptiert

Beantwortet
Definite Integrals in for-loop
Please try code below J = linspace(0,1,1000); kappam = 2*(tanh(2*J)).^2-1; f = @(phi)sqrt(1- kappam.^2 * sin(phi...

fast 10 Jahre vor | 1

| akzeptiert

Beantwortet
How to rewrite recursive funtion without for-loop
a = 1:20; b = 5; c = 3; a1 = a; a1(1:2) = 0; x = filter(1,[1,-b,-c],a1(:));

fast 10 Jahre vor | 2

| akzeptiert

Beantwortet
How to convert arrayfun to for loop
Array = hankel(1:27,[27,1:26]); or count = 27; L = (1:count)'; Array1 = zeros(count); for jj = 1:count ...

fast 10 Jahre vor | 0

Beantwortet
How to take hourly average from 15 minutes random data.
d = xlsread('data1.xlsx',1,'A2:B1147'); d0 = datevec(d(:,1) + datenum([1900 1 -1])); [a,b,c] = unique(d0(:,1:4),'rows','...

fast 10 Jahre vor | 1

Beantwortet
Matlab: trasform cell arrays into a matrix
zz = cat(1,U{:}); zz(cellfun(@isempty,zz)) = {0}; Z = cellfun(@(x)x(1),zz);

fast 10 Jahre vor | 1

| akzeptiert

Beantwortet
Find Indexes above zero in a matrix and replace thoses indexes with the value of a vector with the same length.
B = bsxfun(@times,A > 0,V) + A.*(A <= 0); or [ii,jj] = find(A > 0); B = A; B(sub2ind(size(A),ii,jj)) = V(ii);

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to convert a 3d matrix to a matrix of cells?
C = cellfun(@(x)reshape(x,[],1),num2cell(M,3),'un',0);

fast 10 Jahre vor | 1

| akzeptiert

Gelöst


Determine if a Given Number is a Triangle Number
*Description:* Determine if the elements of an input array are triangle numbers and return the result as an array with the sa...

fast 10 Jahre vor

Gelöst


Isothermal Expansion
Given the initial pressure and volume of an ideal gas, calculate the new volume, given the new pressure. Hint: <https://en.wi...

fast 10 Jahre vor

Gelöst


Remove the vowels
Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

fast 10 Jahre vor

Gelöst


Calculating cost
You sold a Product at $x and gain 10% What was the cost of the product?

fast 10 Jahre vor

Gelöst


Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

fast 10 Jahre vor

Beantwortet
How to create a matrix with for-loop when the columns are unknown?
Let |y_point| - vector [n x 1] [ii,jj] = find(abs(bsxfun(@minus,y_function(:),y_point(:)')) < 1e-3);

fast 10 Jahre vor | 2

| akzeptiert

Beantwortet
Hi everyone, can you help me to solve following program
A = [1,2,3;4,5,6;7,8,9]; C = toeplitz([ones(1,3),2*ones(1,2)],[1 2 2]); C(C==1) = A;

fast 10 Jahre vor | 1

Beantwortet
How to create a piecewise function with if and else statements?
t = -5:30; t0 = [-inf 0 8 16 26 inf]; [~,ii] = histc(t(:),t0); f = {@(t)zeros(size(t)); @(t)10.*t.^2 - 5....

fast 10 Jahre vor | 0

Beantwortet
Matlab to extract the n th diagonals in a Matrix
A = randi(9,5); n = [2,4]; A(sub2ind(size(A),n,n)) = 100*n;

fast 10 Jahre vor | 0

Mehr laden