Solved


Change the sign of even index entries of the reversed vector
change the signs of the even index entries of the reversed vector example 1 vec = [4 -1 -2 9] ans = [9 2 -1 -4] example2...

13 years ago

Solved


Generate a string like abbcccddddeeeee
This is the string version of Problem 1035. <http://www.mathworks.com/matlabcentral/cody/problems/1035-generate-a-vector-like-1-...

13 years ago

Solved


Find Index of maximum Value and maximum Value of a vector
Find the Index of the first occurrence of the maximum value in a vector and also the maximum value in the vector. Example: [...

13 years ago

Answered
Equalities between strings and strings in cell arrays
try isequal(tbl{row,2}{1},'C') or isequal(tbl{row,2}(1),{'C'})

13 years ago | 0

Solved


How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

13 years ago

Solved


Create a Cell array of month-end date strings within a provided date range
This is a variation of <http://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range Get...

13 years ago

Solved


Create a Cell array of month-end date strings within a date range
This is a variation of <http://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range Get...

13 years ago

Solved


Get an array of month-ends in a date range
Create a function that would return a list of month-ends falling in a given date range. If a start date or end date falls on a...

13 years ago

Solved


Cell Counting: How Many Draws?
You are given a cell array containing information about a number of soccer games. Each cell contains one of the following: * ...

13 years ago

Answered
Create a vector form a polynomial evaluation
y = cellfun(@(x,y)polyval(x,y),num2cell(M,2),num2cell(X)); or y = arrayfun(@(n)polyval(M(n,:),X(n)),(1:numel(X))');

13 years ago | 0

| accepted

Answered
Number of zeros in a matrix
a - your matrix number_columns = find(sum(~a) > 12);

13 years ago | 1

Answered
Create a loop which fills numbers 1-7 into matrix until matrix length reached
|A| - your matrix with size <21 x 4 > A(:,2) = rem((0:size(A,1)-1)',7)+1;

13 years ago | 0

| accepted

Solved


Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

13 years ago

Answered
How to split a nxn matrix into n vectors
m = num2cell(M,2); your m1 -> m{1}

13 years ago | 1

Answered
datenum and date conversion
date = [ '1.2.2010' '2.2.2010' '5.2.2010'] time = [ '1:2:59' '2:3:50' '5:4:59'] ...

13 years ago | 0

Answered
find a value in a vector of type char
ismember(data_time,{'7.5.2012' '2:20:59'},'rows');

13 years ago | 0

| accepted

Answered
error horzcat CAT arguments dimensions
peaksK = [distancesK(1); peakssK(:); distancesK(end)]; or peaksK = [distancesK(1), peakssK(:).', distancesK(end)];

13 years ago | 0

| accepted

Answered
Searching on a vector of vector
Xnew = unique(X,'rows');

13 years ago | 0

Answered
stepwise mean value of array
"...the mean value of element 1 and element 100, and the mean value of element 2 and element 200 an so on..." : k = 100:100...

13 years ago | 0

Answered
3D Matrix to replace a square matrix in a for loop?
a = [pi, pi/2, 1, 2*pi, pi/3]; b = [1, 2, 3, 4, 5; 2, 4, 5, 7, 5; 2, 2, 4, 5, 7]; variant 1 s = sin(a); c = ...

13 years ago | 0

| accepted

Answered
Compound Interest with monthly Contributions, Unable to vectorize.
n = 18*12+1; New_balance([1,n],1)=[1000;0]; for j1=2:n New_balance(j1)=New_balance(j1-1)*1.005+100; end or ...

13 years ago | 0

| accepted

Answered
reshaping a matrix in a special way
B = reshape(permute(reshape(A,3,2,[]),[2 1 3]),2,[]);

13 years ago | 1

Answered
How do i plot temperature vs date and time?
file |yourdata.txt| have values: Day Time Temp 1 09:00 16 2 09:00 16.2 ... solu...

13 years ago | 0

Answered
Solving multiple integrals that include exp
T = 9; T1 = 0.25; w = 2*pi/T; k=1; fun = @(t,s)(1+4*s*t).*exp(k*w*t); C = quad(@(t)fun(t,1),-T1,0) + quad(@(t...

13 years ago | 0

| accepted

Answered
Area between a curve and a baseline
|data| - your array < 2 x N >, |data(1,:)| - abscissa; |data(2,:)| - ordinate. plot(data(1,:),data(2,:)); [x y]=ginput(2...

13 years ago | 0

| accepted

Answered
How to get a solution of f(x)=x^3 +x-1 by iteration on Matlab? And x=g(x) ......x(n+1)=g(x) when n>=0. Give that g(x)=1/(1+x^2)
f=@(x)x.^3 +x-1; x(1) = 1; i1 = 1; while abs(f(x)) >= 10^-4 i1 = i1 + 1; x(i1) = 1./(1+x(i1 - 1).^2...

13 years ago | 0

Answered
problem with combvec, allcomb
a = {1,3,[2 6 4],[8 9]}; c = cell(size(a)); [c{:}] = ndgrid(a{end:-1:1}); c2 = sortrows(cell2mat(cellfun(@(x)x(:),c...

13 years ago | 2

Answered
Put two columns matrix into 1 row matrix
|x| - your array [x1;x2;...] |y| - your array [y1;y2;...] xy = reshape([x, y].', 1, []);

13 years ago | 0

| accepted

Answered
How to read text file and put it in to a matrix format.
f = fopen('test.txt'); c = textscan(f,'%s','Delimiter','\n');fclose(f); c2 = c{1}(~cellfun(@isempty,c{1})) c3 = regexp(c...

13 years ago | 0

Load more