Answered
Help. I'm trying to created a code that...........
a = v == 1; ii = [true;diff(a(:)) ~= 0]; i0 = find(ii); iii = reshape(diff([i0;numel(a)+1]),2,[])'; i1 = reshape(...

13 years ago | 0

Answered
how to multiply matrix 2 * 2 if the elements of the matrix are row vectors.
fre=100:100:1000; b = [1 0;0 0]; B = repmat(b,1,1,numel(fre)); B(2,1,:) = cos(2.*pi.*fre); A=[1 9; 9 5]; C1...

13 years ago | 0

Answered
How to get the Coeffcient value?
y = 4; xout = roots([3,2,4 - y])

13 years ago | 2

| accepted

Solved


Negative matrix
Change the sign of all elements in given matrix.

13 years ago

Solved


Find the hypotenuse
Given a and b (the two sides of a right-triangle), find c, the hypotenuse.

13 years ago

Solved


Triangular matrices in 3D array
Given a 3D numeric array _x_, return an array _y_ of the same size in which all entries to the right of the main diagonal are ze...

13 years ago

Answered
Finding X value corresponds to a particular Y value?
X=[5 6 9 8 4]; Y=[8 7 2 1 9]; idx = find(Y == 1); Xidx = X(idx);

13 years ago | 12

Answered
Repeat vectors within a matrix multiple times
x(ones(n,1)*(1:size(x,1)),:); or x(kron(1:size(x,1),ones(1,n)),:);

13 years ago | 0

Answered
Matching only parts of two cell arrays
find(~cellfun('isempty',regexp(A,B)));

13 years ago | 1

Answered
Compair two vectors with different length and different values??
A = randi(25,10,1); B = randi(30,20,1); tolerance = 1; out = abs(bsxfun(@minus,B(:),A(:).')) < tolerance;

13 years ago | 0

Answered
Vectorizing a for loop?
out = (0:npan1).'*(A1+(B1-A1)/npan2);

13 years ago | 0

Answered
I have a cellArray data. Could you tell me how I can extract the first column of this cellArray data without depending any character and number?
cellArray ={'A29G0202 465254.432 4066809.025'; 'A29G0008 499252.083 4042876.84'; ...

13 years ago | 0

| accepted

Answered
regexp usage for cellArray data which includes both characters and numbers.
cellArray ={'O2930202 465254.432 4066809.025'; 'O2910008 499252.083 4042876.84'; 'O2920014 ...

13 years ago | 0

| accepted

Answered
More sophisticated code than a for loop with i is large
Let |e = [e11 e12 e13; e21 e22 e23; e31 e32 e33; ...... e101 e102e103];| out = e.'*e; out(2,2) = sum(e(:,2));

13 years ago | 0

| accepted

Answered
Plotting mean of values based on number in column
m = [1,2,3,4,5,6; 1,2,1,2,1,2]; means = accumarray(m(2,:).',m(1,:),[],@mean);

13 years ago | 0

Answered
I have two cellArray which class are cell. I want to extract first column of these cellArray.
cellArray ={' 334 4261461.0645 2661117.6797 3918916.0472' ' 352 4266205.852 2659683.96 3...

13 years ago | 0

| accepted

Answered
I have a data which class is char, containing n rows and 4 columns. I wanna extract first column.
a = regexp(cellstr(a),'\d*(\.\d*)?','match'); b = str2double(cat(1,a{:}));

13 years ago | 0

Answered
How can I save the results of every loop in a for-loop with two counters
a0 = cellfun(@(x)sum(x>0,2) < 2,E,'un',0); a = cat(1,a0{:});

13 years ago | 0

| accepted

Solved


Now 20% off!
Furloughs are hitting government workers this year. To commemorate getting one unpaid day off each week until the end of Septem...

13 years ago

Solved


Connect Four: find winning move
Inspired by <http://www.mathworks.com/matlabcentral/cody/problems/90-connect-four-win-checker this problem>... <http://en.wik...

13 years ago

Solved


Maximum value in a matrix
Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

13 years ago

Answered
Integrating sin(2x) in MATLAB
syms x out = feval(symengine,'combine',int(sin(2*x)),'sincos')

13 years ago | 0

| accepted

Solved


Calculate distance travelled when given radius and rotations
When given radius of wheel and number of rotations calculate total distance travelled consider pi=3.14

13 years ago

Solved


Count consecutive 0's in between values of 1
So you have some vector that contains 1's and 0's, and the goal is to return a vector that gives the number of 0's between each ...

13 years ago

Solved


Find last zero for each column
Given a numeric array of arbitrary size, return the row index of the last zero for each column. If a column contains all nonzero...

13 years ago

Answered
b=regexprep(b,'^','.^','all'); doesn't works.
syms t; a=t^3+t*t+t^2/t; b = vectorize(a);

13 years ago | 0

| accepted

Answered
How can I sort the output matrix according to the prescribed order in a column?
a = [1 0.5 0.8 10 0.6 0.5 11 0.3 0.1 13 0.1 0.8 9 0 15]; b = [11 9 10 1 13]; [~,ia] = sort(a(:,...

13 years ago | 0

Answered
Convert 10 minute average to hourly
Madd = randi([10 20],50,1); data = [datenum(2013,2,1,0,cumsum(Madd),0), randi(2500,numel(Madd),1)]; % Let your data - tw...

13 years ago | 2

| accepted

Answered
Creating a 2-D matrix from a 1-D Array?
out = A(randi(numel(A),256,256)); or m = 256; n = 256; A1 = repmat(A,1,ceil((m+n-1)/numel(A))); out = hankel(...

13 years ago | 0

Load more