Answered
Basic Moving Average Calculation
movingAVGResult=conv(SData(:),ones(30,1)/30,'valid');

8 years ago | 1

| accepted

Question


How reshape and variable assignments are handled internally within MATLAB?
Does anyone know what exactly happens when you are trying to reshape a variable? So, let's say I have a large array called large...

8 years ago | 2 answers | 1

2

answers

Answered
Arrayfun application to avoid a FOR loop
You can replace for n = 1:size(alpha,3) gamma(:,:,n) = corrcoef(alpha(:,:,n), beta(:,:,n)); end with ...

8 years ago | 1

| accepted

Answered
conditionally removing rows dependent on values of other rows
[x,y]=ndgrid(1:10); A=[x(:) y(:)]; a=3; mask = ((x-a)<y) & (y<(a+x)); plot(A(mask,1),A(mask,2),'x','Marker...

8 years ago | 0

| accepted

Answered
read an array and output at intervals
mask = (mod(prcp(:,1),1000) == 106); out=prcp(mask,:) if you want to also include "1998001 0", (apparently the fi...

8 years ago | 0

| accepted

Answered
How do I skip every other row of data in an array and write to a text file or another array?
every3rdRowData = Data(1:3:end,:)

8 years ago | 2

| accepted

Answered
3D plotting of ANFIS training data
seems surface(Input1,Input2,Output) should do the job. and keep Input1/2 and output as their original size, i.e. [32 16]...

8 years ago | 0

| accepted

Answered
Adding matrices in 4D to 3D
total_hitrate_matrix = sum(hitrate_matrix,4) This adds up the 4th dimension and the resulting matrix would be 7x7x7.

8 years ago | 1

| accepted

Answered
Saving variables within a parfor loop
Two things: (1) When using <http://www.mathworks.com/help/matlab/ref/save.html#inputarg_variables save()> the way that you a...

8 years ago | 1

| accepted

Answered
Command Window Output to txt file
You could instruct your code to force the diary into a separate file each time your code is executed. Something like this: ...

8 years ago | 2

| accepted

Answered
how to solve this equation?
well a quick look at the equation, t=0 is always the solution regardless of the value of K. However, if you want to solve the...

8 years ago | 0

| accepted

Answered
How I can convert the U,V,W coordinates to its respective angles?
You have to define first the angle relative to what. Let's say you want the angle relative to x-y plane. A vector that is per...

8 years ago | 0

| accepted

Answered
How to calculate the middle point between two points on the Earth in matlab?
Go to <http://www.movable-type.co.uk/scripts/latlong.html this page> you will find bunch of useful formula. The one that you are...

9 years ago | 0

| accepted

Answered
How to get a subtable out of a large table on conditions
mask=strcmpi(myTable.firstColumn(:),'ATL') & ... strcmpi(myTable.thirdColumn(:),'7/7/2015'); newTable=myTable(m...

9 years ago | 0

| accepted

Answered
How to make exceedance curve using histc?
Just do the cumsum backwards on your histogram output % generating some data v=normrnd(0,1,[1,1000]); % getting t...

9 years ago | 0

| accepted

Answered
How can i replace a number with its no of ocurrences
a=[1 0 1 0 1;0 1 1 1 1;1 1 0 1 1;1 1 1 1 1]; cumsum(a,2).*a ans = 1 0 2 0 3 0 1 ...

9 years ago | 1

| accepted

Answered
How can I find the yearly average with repeating years?
use <http://www.mathworks.com/help/stats/grpstats.html;jsessionid=1640652ecf34bc6ffec51116154f grpstats()> meanYearly=grpst...

9 years ago | 2

| accepted

Question


saving within SPMD or parfor
Why matlab does not allow to save something to a file when within spmd or parfor? let's say I have: parfor i=1:n or spmd...

9 years ago | 2 answers | 3

2

answers

Answered
Find local minima in greyscale image
check <http://www.mathworks.com/help/images/ref/imregionalmin.html imregionalmin()> and <http://www.mathworks.com/help/images/re...

9 years ago | 3

| accepted

Answered
Accuracy and precision computation
Use <http://www.mathworks.com/help/stats/confusionmat.html confusionmat()> to build a <http://en.wikipedia.org/wiki/Confusion_ma...

9 years ago | 2

| accepted

Answered
searching for vector values in a matrix
% Creating a sample matrix yourMatrix=reshape(1:15,5,3) yourMatrix = 1 6 11 2 7 12...

9 years ago | 0

| accepted

Answered
Fast way to replicate array
w=[1 2; ... 3 4; ... 5 6]; N=5; E=size(w,1); F=size(w,2); D=repmat(reshape(w',1,F,1,E),N,1,N,1);

9 years ago | 0

| accepted

Answered
How to import blanks cells as Nans
use <http://www.mathworks.com/help/matlab/ref/importdata.html importdata()>: a=importdata('sampledata.csv') a = ...

9 years ago | 3

| accepted

Answered
forward, backward and central differences
%% Fun = @(x) exp(-x).*sin(3*x); dFun = @(x) -exp(-x).*sin(3*x)+ 3*exp(-x).*cos(3*x); %% x=linspace(0,4,101)...

9 years ago | 17

| accepted

Answered
Linear Regression Matlab code
% First COLUMN is galon, the next two columns are amount of time required % to remove that amount of gallons. I assumed you...

9 years ago | 3

| accepted

Answered
Getting the Polynomial coefficients
*Part I* You are using <http://www.mathworks.com/help/symbolic/sym.html?searchHighlight=sym SYM()> while using <http://www.ma...

9 years ago | 0

| accepted

Answered
i want to mark the highest point of any non-black pixel within the image to find the max point.
row=find(sum(BWImage,2)==0,1,'last')+1; col=find(BWImage(row,:)~=0); row=row*ones(size(col)); Points=...

9 years ago | 1

| accepted

Answered
How to repeat a row by a certain factor
% Creating sample data A=[2 2 2; 3 3 3; 4 4 4]; nRep=[2,1,3]; % Constructing A_New as instructed. A_new=c...

9 years ago | 0

| accepted

Answered
How to use a char variable name as a numeric variable
Similar question has been asked. Try the answers on this post: http://www.mathworks.com/matlabcentral/answers/213097-havin...

9 years ago | 0

| accepted

Answered
How do I get the least used character in the text file ?
%Sample text; equivalent to your a txt='this is a sample text.'; uniqueChars=unique(txt(isletter(txt))); ...

9 years ago | 0

| accepted

Load more