Solved


letter yes yes & letter no no
Split a string into two strings, first string has all alphabetic letters, next string has all the rest, keep the order please, o...

14 years ago

Solved


Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

14 years ago

Solved


Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

14 years ago

Solved


Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

14 years ago

Solved


Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

14 years ago

Solved


Pascal's Triangle
Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...

14 years ago

Solved


Return a list sorted by number of consecutive occurrences
Inspired by Problem 38 by Cody Team. Given a vector x, return a vector y of the values in x sorted by the number of CONSECUTIVE...

14 years ago

Answered
fixing a problem with the date format
xlswrite('yournamefile.xlsx',cellstr(datestr(datevec(A,'mm/yy'),'mm/yyyy')))

14 years ago | 0

Answered
Create a vector in Matlab
simple example: I = zeros(1,10) i1 = 5 i2=7 I(i1:i2) = .9

14 years ago | 1

| accepted

Answered
sum a column depending on another column
out = sum(A(A(:,4)~=0,2))

14 years ago | 1

| accepted

Answered
A question about a for loop
Data=xlsread('bootstrap.xls','blad1','A1:G4740'); mv_laag=[0.13 0.62 0.03 0 0.00 0 0.23]'; d = Data*mv_laag; out = re...

14 years ago | 0

Answered
erasing specifi rows from a cell matrix
[~,b] = unique(A(:,1),'first') Aout=A(sort(b),:) or [c,c,c] = unique(A(:,1)); Aout=A(~([false;diff(c)==0]&~cellf...

14 years ago | 0

Answered
identifying successive dates in a cell vector
[a,b,c] = unique(A); [jj,jj] = sort(b); out = accumarray(c,(1:numel(c))',[],@(x){x}); out = [a(jj),out(jj)]; ADD ...

14 years ago | 0

| accepted

Answered
datestr not working properly
datestr(datenum(raw,'dd/mm/yyyy HH:MM:SS'), 'yyyy-mm-dd HH:MM:SS')

14 years ago | 0

| accepted

Answered
Vector operatin in Matlab
Y= [0.1 0.3 0.4 0.8 0.3 0.5]; Y1 = [0.2323 0.25656 0.8]; out = [zeros(1,numel(Y1)-numel(Y)),Y].*[zeros(1,numel(Y)-numel(...

14 years ago | 0

| accepted

Answered
Circular indexing of an array
in this case X = 1:10; conv(X([end,1:end]),[1 1]/2,'valid');

14 years ago | 0

Solved


Duplicates
Write a function that accepts a cell array of strings and returns another cell array of strings *with only the duplicates* retai...

14 years ago

Solved


Remove the small words from a list of words.
Your job is to tidy up a list of words that appear in a string. The words are separated by one or more spaces. Remove all words ...

14 years ago

Solved


Getting the indices from a matrice
Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

14 years ago

Solved


Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

14 years ago

Solved


Add more zeros
Find code that adds one 0 to each sequence of 0 in a string (composed with only 0 or 1). For example: '1010' -> '100100' ...

14 years ago

Answered
How can I pas a matrix to function handle which is going to be used in ode45 solver?
A = [a b c, d e f, g h i]; example = @(t,y)A*y; [X,Y]=ode45(example,xspan,ynot);

14 years ago | 0

Answered
how to convert a matrix to a cell array
please read about functions <http://www.mathworks.com/help/techdoc/ref/num2cell.html |num2cell|> and <http://www.mathworks.com/h...

14 years ago | 9

| accepted

Answered
how to get a integral vector result very fast with the upper limits which are supplied in an array?
try result = arrayfun(@(x)quad(tempFunction, 0, x),x);

14 years ago | 0

| accepted

Answered
Finding the number of consecutive points in a given vector, using a condition
with function |regionprops| from |Image Processing Toolbox| idx = regionprops(A<1,'Area','PixelIdxList'); out = cell...

14 years ago | 0

| accepted

Solved


Replace all zeros and NaNs in a matrix with the string 'error'
Given a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with ...

14 years ago

Answered
Size of Images varying
m = size(A); A1 = zeros([m(1:2) + 2,m(3)]); A1(2:end-1,2:end-1,:) = A; Af = zeros(m); for ii = 1:m(1) for j...

14 years ago | 1

| accepted

Solved


Replicate elements in vectors
Replicate each element of a row vector (with NaN) a constant number of times. Examples : n=2, A=[1 2 3] -> [1 1 2 2 3 3] n=0...

14 years ago

Answered
data frequency conversion -cell matrix
n = cellfun(@(x)x/2,A(:,3:end),'un',0); Out = []; for ii = 1:size(A,1) if strcmp(A(ii,2),' ') Out = [O...

14 years ago | 0

| accepted

Answered
advanced sorting of cell array of strings
k = regexp(files,'((?<=a_20_)\d*)|((?<=rpm_)\d*)','match'); [ii,ii] = sortrows(str2double(cat(1,k{:})),[-1 2]); files(ii...

14 years ago | 1

Load more