Answered
filtering values of one matrix according to another
V1 = V(ismember(V(:,3),F),:);

14 years ago | 0

| accepted

Answered
compute the means of a 3-dimensional cell array.
Here |C| - cell array of 20x1x19 |C{1}| - a double array of 80 x 90 sC = size(C); out0 = mean(cell2mat(reshape(C,1,1,...

14 years ago | 2

Answered
Create random values between two decimal values
use |unifrnd| from the |Statistics Toolbox| en_points(1:NUM_EN_POINTS,2) = unifrnd(.5 - l,.5 + l,NUM_EN_POINTS,1); OR ...

14 years ago | 2

Answered
How can I get a row vector where a specific element found is located within a matrix?
A =[ 2009 8 2 4 2010 3 4 5 2011 6 9 1 2012 1 3 7]; [ii,ii] = min(A(:,3)); out = A(ii,:); or out = ...

14 years ago | 0

| accepted

Answered
??? Subscript indices must either be real positive integers or logicals.
f1 = @(n)cumsum((-1).^n./3.^n); g1 = @(n)3/4+1/4*(-1/3).^n; >> N = 10; >> n1 = 0:N; >> f1(n1) ans = ...

14 years ago | 0

Answered
Copying and replacing of some values
c_final = a; c_final(bsxfun(@plus,b,(0:n)')) = repmat(a(b),n+1,1);

14 years ago | 0

Answered
how to do this in a for loop in Matlab
dff = diff(W,1,3) a = dff([20:50,60:90],110:140,:) meanN = mean(reshape(a,[],size(a,3))); erN = .1 - abs(meanN);

14 years ago | 3

| accepted

Answered
how to calculate the integral int (sin(a*x))^2*exp(-b*x^2)/(x^2)
>> fun = @(a,b)quadgk(@(x)sin(a.*x).^2.*exp(-b.*x.^2)./x.^2,0,inf); >> fun(1,1) ans = 0.76351

14 years ago | 0

| accepted

Answered
calculating mean values of a 3D matrix
out = mean(yourarray3D,3)

14 years ago | 7

| accepted

Answered
how to convert exponentional number into a decimal number
a = 1.0e+013 * [ 0.0106 1.9718] out = a.*10.^-max(floor(log10(a)))

14 years ago | 0

Answered
how to convert exponentional number into a decimal number
a*10^-ceil(log10(a))

14 years ago | 0

Answered
Size mismatch error using Matlab function to solve equations
R=roots([A B C D E]); S=zeros(1,4); t = abs(imag(R)) < eps(100); S(t)=real(R(t));

14 years ago | 1

| accepted

Solved


Partial pivoting for Gauss Elimination
Write a function to implement partial pivoting for Gauss elimination, given the pivot element.

14 years ago

Answered
Vectorization of a Value function
ii = cell(1,4); [ii{:}] = ndgrid(1:Ny,1:Nr,1:Nd,1:Nw); v = cellfun(@(x)x(:),ii,'un',0); V = zeros(size(ii{1})); V(...

14 years ago | 1

| accepted

Answered
Need to match Data
A = [7 3 5 9; 23 54 76 86]'; B = [3:15]'; [a,b] = ismember(B,A(:,1)); B(a,2) = A(b(a),2);

14 years ago | 0

Answered
How to extract a part of a matrix with condition in Matlab
x = your_matrix; out = x.*(x>=1.66&x<=1.77);

14 years ago | 1

| accepted

Answered
Changing a Function to Accept vector inputs?
function y = FcnEval(x) y = zeros(size(x)); for ii = 1:numel(x) if x(ii) < -2; y(ii) = 1./((x(ii).^2) ...

14 years ago | 0

Answered
Select a matrix with a specific number of columns, name unknown
eg load('nameyourfiledata'); c = whos; N = 9; % number columns in matrix t = strcmp({c.class},'double') & cellfun(...

14 years ago | 0

| accepted

Answered
How to specify a variable (using linspace) like this?
afirst = 2; h = .5; N = 5; out = afirst + cumsum([0, .5*h,ones(1,N-1)*h,.5*h]) or out = [afirst,linspace(afir...

14 years ago | 0

Answered
Replacing Occurrences of String?
please try this is code: out = input_sentence; ii = strfind(out,str1) if ~isempty(ii) for ii = ii o...

14 years ago | 0

| accepted

Answered
Using xlswrite with cell array containing strings and numbers
A = {[5] ['fadfafdas'] ['safdafas'] [24] ['dfd'] ['dds']} xlswrite('yourxlsfile.xlsx',A)

14 years ago | 0

Answered
Basic While Loop Help?
Please see <http://www.mathworks.com/matlabcentral/answers/48587-arrange-array-of-9-numbers-in-ascending-order-no-sort answer> b...

14 years ago | 0

Answered
How do I find the zeros of my function?
x = (-2:0.01:2); f = @(x)2*x.^4-3*x.^2+x-7; d = f(x); [a, i1] = findpeaks(d); [b, i2] = findpeaks(-d); b = -b;...

14 years ago | 0

Solved


Remove all the words that end with "ain"
Given the string s1, return the string s2 with the target characters removed. For example, given s1 = 'the main event' your ...

14 years ago

Solved


QWERTY coordinates
Given a lowercase letter or a digit as input, return the row where that letter appears on a <http://en.wikipedia.org/wiki/Keyboa...

14 years ago

Answered
how to get cross product of two vectors?
A = randi(18,4,4,3); B = randi(10,4,4,3); %The initial arrays with size (4x4x3) out1 = cellfun(@(x,y)cross(x,y),num2...

14 years ago | 0

Solved


Piecewise linear interpolation
Given an Mx2 vector and a row of M-1 integers, output a two column vector that linearly interpolates Y times between each succes...

14 years ago

Solved


Implement a ROT13 cipher
Replace each character in string s1 with the character that is shifted 13 positions from it (wrap back to the beginning if neces...

14 years ago

Solved


Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

14 years ago

Answered
Decimals to Roman Numerals
from <http://www.mathworks.com/matlabcentral/cody/problems/63-encode-roman-numerals Cody> function ans = dec2rom(z) d = ...

14 years ago | 3

Load more