Answered
Separating numbers and characters from input
str = '123wd57ab934bd3'; z = regexp(str,'(\d*)([a-z]*)','tokens'); out = [z{:}]; out = out(~cellfun(@isempty,out));

9 years ago | 0

Answered
Multiply specific parts of cell with cell column
y1 = {10 11 12 13 14 15 16 17 18 19 20 21 22 23 24}; y = cell2mat(y1); out = y(2:3,2:3).*y(2:3,5); ...

9 years ago | 0

Answered
Text File Reading with Text and Numbers
f = fopen('Ex.txt'); c = textscan(f,'%s','delimiter','\n'); fclose(f); z = regexp(c{:},'(\-?\<\d+\.?\d*\>)','to...

9 years ago | 0

Answered
How do I create a matrix/vector according to a formula?
jj = (1:10)'; ro = 2*(1-cos(23*pi/51))*sin(23*pi*jj/51);

9 years ago | 2

Answered
Plotting a polynomial function with roots
syms x f = x^3 - 10/(2-x)^2 + 25 [n,~] = numden(f); [c,~] = coeffs(n); your_roots = roots(double(c)); your_roo...

9 years ago | 0

Answered
delete rows from matrix A in patten
Maybe so? out = A(rem(ceil(1:size(A,1))/60,2)==1,:);

9 years ago | 0

Answered
how can i remove efficiently nan values from columns without deleting the column itself ?
i0 = ~isnan(A); ii = sort(i0,'descend'); out = nan(size(A)); out(ii)=A(i0);

9 years ago | 0

Answered
removing rows contain NaN element from 3D array
out = arrayfun(@(x)A(all(~isnan(A(:,:,x)),2),:,x),1:size(A,3),'un',0);

9 years ago | 1

Answered
daily max -min , sum, average of hourly data sets.?
[y,m,d] = datevec(tempdata(:,1)); [a,~,c] = unique([y,m,d],'rows'); out = [a, zeros(size(a,1),7)]; out(:,4) = accumar...

9 years ago | 1

| accepted

Answered
How do I generate a 4 dimensional matrix of dimension 5x5x5x5 with random complex numbers as elements?
Maybe so? B = A(:,:,end:-1:1,:); or B = flip(A,3);

9 years ago | 0

Answered
How to integrate functions inside a loop
a = dlmread('density.txt'); en1 = a(:,1); int1 = a(:,2); El = 0; Tl = 0.41; Em = -918.85; Tm = 0.17; ...

9 years ago | 1

| accepted

Answered
How can I arrange my output from regexp stored in multiple cells in a for loop?
tokens = regexp(DATALow, '\<(R\d{2})/(\d{4})[A-Z]+(?:(?:\d{4})[A-Z])?\>', 'tokens'); out = cellfun(@(x)cat(1,x{:}),toke...

9 years ago | 0

Answered
How to use arrayfun with a function having two vector arguments?
fW = @(x) f(W, x); out = cellfun(fW,{x1,x2,x3},'un',0);

9 years ago | 0

| accepted

Answered
How to convert a matrix to cell array of vectors?
out = num2cell(R,2);

9 years ago | 0

| accepted

Answered
Replace rows with NaN only if there are more than two continous zero values in the same column
t = Input(:,2) == 0; [ii,c] = bwlabel(t); x = accumarray(ii+1,1); x = x(2:end); z = 1:c; Input(ismember(ii,z(x ...

9 years ago | 0

| accepted

Answered
Replace with the mean if there are at least six continous NaN in the same column
t = isnan(A(:,2)); tt = diff(t); n = mean([A(tt == 1,2),A([false;tt == -1],2)],2); ii = t.*cumsum([false;tt == 1]); ...

9 years ago | 0

Answered
Delete some rows where column 1 = certain value
out = your_data(ismember(your_data(:,1),[67, 22, 32]),:);

9 years ago | 0

Answered
How can I find MIN value with same number in the other column?
ii = diff([~A(1);A(:,1)])~=0; out = [A(ii,1), accumarray(cumsum(ii),A(:,2),[],@min)];

9 years ago | 0

Answered
Calculating daily Average if only, the value is not zero
let |data| - your matrix (8760 x 2), here first column - timestamp (serial date number), second - solar radiation. t =...

9 years ago | 0

Answered
How to emtpy part of a matrix?
a = [1 2; 3 4; 5 6; 7 8]; a(2:3,1) = nan;

9 years ago | 0

| accepted

Answered
Nodal admittance matrix using for loop and if statement
Y = diag(sum(B_matrix,2)) - (~eye(size(B_matrix))).*B_matrix;

9 years ago | 0

| accepted

Answered
How can I create a 10x10 matrix with (i,j) positions in the matrix defined by i-j
for MATLAB R2016a: out = (1:10).'-(1:10);

9 years ago | 0

Answered
how to convert m by n matrix to colunm wise array
Please read about <http://www.mathworks.com/help/matlab/ref/reshape.html |reshape|> out = reshape(A,[],1).'; % A - your ma...

9 years ago | 0

Answered
How to construct a Row Vector
L = 5; % or L = 1000 out = [zeros(1,L),1,zeros(1,L)];

9 years ago | 0

| accepted

Answered
how to remove a specific section of a cell
a(2:end,1) = {[]};

9 years ago | 0

| accepted

Answered
Can someone help me with the matlab numerical code to find the optimum minimum values of the function, f(x) where x(1) and x(2) should not be negative.
f = @(x)x(1) + 2*x(2); x_min = fmincon(f,[1;1],[1,1;-2,-3],[2;-4],[],[],[0;0]);

9 years ago | 0

Answered
How to find an intersection point between line and curve by fzero
rx = fminbnd(@(X)-r_fun_diff(X),0,1) ry=feval(r_fun,rx)

9 years ago | 0

| accepted

Answered
How to split alphanumerical string without delimiter?
f = fopen('Data20161014.csv'); % Data20161014.csv - your csv file c = textscan(f,'%s','delimiter','\n'); fclose(f); ...

9 years ago | 0

| accepted

Answered
How can I do an average for certains values of a column?
|Data| - your matrix (4711 x 2) [a,~,c] = unique(Data(:,1)); out = [a, accumarray(c,Data(:,2),[],@mean);

9 years ago | 1

Load more