Answered
Fastest way to cross reference two tables
It would help if you attached your data. gp=sortrows(table2array(grid_points)); f=sortrows(table2array(forces)); idx=ismember...

4 years ago | 0

| accepted

Answered
Check if ID exist in second table
A = ["1","2","3"]; B = ["2","3"]; C=A(~ismember(A,B))

4 years ago | 0

Answered
Measure time difference peaks and stores it
I assume you have an t-array and a y-array. c=1; while any(y>=1) f1=find(y>=1,1); y(1:f1-1)=[]; f2=find(y<=0,1)...

4 years ago | 0

Solved


Parametric Array
Create a row vector, 1xN (Integer, >1), such that the mean of the vector is M (Real number) and the standard deviation of the ...

4 years ago

Answered
20 periods moving average
a=randi(100,3000,100); A=movmean(a,20,2,'Endpoints','discard');

4 years ago | 1

Answered
How to compute harmonic average on the blocks of an array?
a=randi(100,1,100);%some vector for k=1:length(a)-3 A(k)=harmmean(a(k:k+3)); end

4 years ago | 0

| accepted

Answered
Want to run same script for 100 times without changing any variable and then taking the average of the output.
for k=1:100 yourScript; Output(k)=y;%whatever variable that is the output end m=mean(Output); plot(Output);

4 years ago | 0

| accepted

Solved


Chain multiplication - 04
Following up on the problem in 55305, you found the optimal way to multiply a chain of matrices. However, here in this problem,...

4 years ago

Solved


Nuemann Polynomials
Return the coefficients of nth (n>=0) Nuemann polynomial, (a sequence in 1/t) as polynomials in alpha. The expected output is a...

4 years ago

Answered
How to jump to first loop if nest for loop need to terminate due to condition
for i=1:10 for j=1:100 %code tline=fgetl(fid) if tline==-1 break; end fprintf(fid,tline) ...

4 years ago | 0

| accepted

Answered
how do i store mutiple txt files into a 3d matrix
Matrix=zeros(156,207,3000); for i = 1:3000 Matrix(:,:,i)=readmatrix(['frames_' num2str(i-1) '.txt']); end

4 years ago | 0

Answered
Is there a more efficient way to format my vector rather than manually change the code
TV =@(tme) [tme(1):30:tme(2)-30, tme(2):15:tme(3)-15, tme(3):12:tme(4)-12,... tme(4):2.4:tme(5)-2.4, tme(5):2.1428:tme(6)-2...

4 years ago | 0

| accepted

Answered
How to plot a data in spherical coordinates?
[x,y,z]=sph2cart(th,conc,r); surf(x,y,z);

4 years ago | 0

| accepted

Answered
How can I make these few lines a function?
function graphSetup() set(gca,'color',[1 1 1]); set(gcf,'Position',[-2237,65,2084,1272],'Resize','on'); box on; set(...

4 years ago | 1

| accepted

Solved


Chain multiplication - 03
Following up the problem in 55305, you found the minimum number of multiplications needed to multiply a chain of matrices. In ...

4 years ago

Answered
I want to subset values in a table based on a range of numbers specific to one of my variables.
W=randi(500,100,1); A=randi(500,100,1); M=[W(W>=400&W<+450),A(W>=400&W<+450)]

4 years ago | 0

Answered
Only applying a "for" command on half of the matrices in it
m=randi(10,10,10,60);%generate your matrix (should store as 3-D matrix) r=randperm(60,30);%generate the 30 affected matrices f...

4 years ago | 0

Solved


Chain multiplication - 02
Following up on the problem in 55295, you found the number of multiplications needed to multiply two matrices. Now, you are giv...

4 years ago

Solved


Cut the rod
A rod of length n can be cut in different sizes. Different price is associated with different length of cuts. length, len= [1,...

4 years ago

Solved


Number of leaps in binary search
Binary search is one of the most popular searching algorithms (Binary Search Algorithm). It works only in a sorted array. It uti...

4 years ago

Solved


Sort Non-zeros
Consider 0s in a vector creates a break-point. sort all the sub-arrays created by those break points. For example, a = [3, 4, 1...

4 years ago

Solved


Chain multiplication - 01
Say, you are given two matrices - A (shape= 3*4) and B(shape = 4*5). If you multiply these two matrices, the resultant matrix w...

4 years ago

Answered
How to convert character column to 4 byte (total 32 bits) data?
dec2bin(15226547,32)-'0'

4 years ago | 0

Answered
Extract specific rows and columns from excel and store in a matrix
If formating is consistent, readmatrix should work. listing=dir; M=[]; for k=1:length(listing) m=readmatrix(listing(k)....

4 years ago | 0

Answered
I want to create a binary matrix with a variable dimensions
k=10; M=50; O=randi(M+1,k)-1;%number of ones per row (number of zeros per row= 50 - O) for n=1:k m=[ones(1,O(n)),zeros(1...

4 years ago | 0

Answered
Combination of 2 image
idx=find(B(:,:,1)~=0&B(:,:,2)~=0&B(:,:,3)~=0);%find ~black pixels in image B C=B; C(idx)=A(:,:,idx);%set ~black pixels to imag...

4 years ago | 0

| accepted

Answered
Match numbers to allocate text
Your could also use a sparse array or an array of nan. x=[12 13 19 21]; y=[12 13 19 24 21 12 12]; X=nan(1,25); X(x)='ABCD'; ...

4 years ago | 0

Answered
How to find x value for a known y in array plot?
[~,idx]=min(abs(y-.8*max(y)));%.8*max(y) is not part of the y-array, find the closest y-idx to that value x(idx)

4 years ago | 0

Load more