Answered
using cat for a sequence of files
about function |cat| fname = {'dataoutput1.xlsx','dataoutput2.xlsx','dataoutput3.xlsx','dataoutput4.xlsx'}; a = cellfun(...

14 years ago | 0

| accepted

Answered
reading an image
one way for ii = 1:size(X,3) imshow(X(:,:,ii)); end

14 years ago | 0

| accepted

Answered
Re-Asking a Question: Creating a Connection Matrix from an indexed point set
|a| - your matrix a =[0 0 10 0 0 0 3 4 -4 2 6 10]; fp = [ 0 0 ...

14 years ago | 1

| accepted

Answered
select a band of a matrix
[ii,jj]= ndgrid(1:size(a,1),1:size(a,2)); [I J] = find(ismember(a,[21;55;6;29])); out = a.*(ii - I(1) > (diff(I(1:2)))/(...

14 years ago | 1

| accepted

Answered
grouping observations accordeing to string dates with empty cells
try ms = cellstr(reshape(datestr(datenum(0,1:12,1,0,0,0),'m'),2,[])'); dd = regexprep(data(:,3),ms,cellstr(('1':num2str(...

14 years ago | 0

| accepted

Answered
Checkign if a spreadsheet in excel file is empty?
try this is code %Enter folder path with XRD files source_dir = 'C:\Users\Desktop\XRD Process\'; source_files = dir(f...

14 years ago | 0

Answered
Reading multiple files
try regiao=dir('regiao*.txt'); for k=1:10; nome=regiao(k).name; id=fopen(nome,'r'); nms = tex...

14 years ago | 0

| accepted

Answered
How to read the words and numbers to different cells according to space and next line ?
id=fopen('nameyourfile.txt','r'); nms = textscan(id,'%s'); fclose(id); out = nms{1};

14 years ago | 0

Answered
Calculating the sum of this array
eg l = struct('populacao',{18000;20000;16000;11000;1900}); out = sum([l.populacao]);

14 years ago | 0

| accepted

Answered
sorting columns with empty cells
d1 = mdata1(:,11); d1(cellfun('isempty',d1)) = {'00-00-0000'}; [id,id] = sort(datenum(d1,'dd-mm-yyyy')); out = mdata1...

14 years ago | 0

| accepted

Answered
Find euclidean distance of a m X 2 matrix
a =[ 1 ,2; 3, 4;5,6] x =[1,10]' out = sqrt(sum(bsxfun(@minus,a,x.').^2,2))

14 years ago | 1

| accepted

Answered
gathering together specific elements from a column vector
eg k = cellstr(reshape(datestr(datenum(0,1:12,1,0,0,0),'m'),2,[])') t = cellfun(@(x){x(1:2) x(3:end)},A(:,3),'un',0) ...

14 years ago | 0

| accepted

Answered
extract diagonal blocks of sparse matrix
eg A = randi(1548,11); k = mat2cell(1:size(A,1),1,[2 3 5 1]); t = cellfun(@(x)A(x,x),k,'un',0); out = blkdiag(t{:}...

14 years ago | 1

| accepted

Answered
Multiples of 5
|x| - your array out = x(rem(x,5) ~= 0)

14 years ago | 0

Solved


Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

14 years ago

Answered
how to calculate spline of the function?
X = [args;args] Y = [vals;derivs] P = spapi(4,X(:),Y(:)) *after* comment ppp = csape([-1 1],[3 -1 1 3],[1 1]) ...

14 years ago | 0

| accepted

Answered
matrix
EDIT A = rand(5) [id,id] = sort(A,2) minrowloc = id(:,1) maxrowloc = id(:,end)

14 years ago | 1

| accepted

Answered
creating a sequence of strings
cellstr(strcat('l',cellfun(@(x)x{:},nchoosek(regexp(A,'\d','match'),2))))

14 years ago | 0

| accepted

Answered
Storing matrix value
[id,id]=min(A(1,:)) Z = A(2:end,id)

14 years ago | 0

| accepted

Answered
Optimization of for loop to generate matrix
sh = arrayfun(@(ii)C*A^ii,(9:-1:0).','un',0) H = cat(1,sh{1:end-1}) S0 = [cellfun(@(x)x*B,sh(2:end));0] S = S0(bsxfun...

14 years ago | 0

Answered
Function handle
fhandles = @(n)cellfun(@str2func,cellstr(strcat('@(x)x.^',num2str((0:n)'))),'un',0)

14 years ago | 0

Answered
calculating each elements of matrixs
C = reshape(bsxfun(@minus,A',permute(B',[1 3 2 ])),size(A,2),[])' or C = reshape(bsxfun(@minus,permute(A,[1 3 2]),per...

14 years ago | 0

| accepted

Answered
Getting first element of a function output
no easier way result = subsref(test(input),struct('type','()','subs',{{1}}))

14 years ago | 6

Answered
How to create a regular data matrix from irregularly sampled XYZ data with different X and Y coordinates
[ii,i2,i2] = unique(d(:,1)); [jj,j2,j2] = unique(d(:,2)); out = [[NaN,ii'];[jj,accumarray([j2,i2],d(:,3),[],[],NaN)]]

14 years ago | 0

Answered
Find Angle Between Two Line
v1=[4,3]-[0,3]; v2=[0,2]-[3,0]; angle = mod( atan2( det([v1;v2]) , dot(v1,v2) ) , 2*pi ); EDIT a1 = mod(atan2( ...

14 years ago | 1

Answered
partitioning a matrix based on another
k = mat2cell(X,ng,size(X,2)) [x1,x2] = k{:}

14 years ago | 0

| accepted

Answered
how read array from a text file??
A = dlmread('nametextfile.txt')

14 years ago | 0

Answered
Complex Matrix interpolation
interp1([0 1 4],[0,8+2i,6-5i],[3 3.5]) add eg: for |Z| Z = arrayfun(@(ii)randi(9)+((-1)+randi([0 1]))*randi(16)*1i,...

14 years ago | 0

Answered
Reduce the numbers of inputs in a numerical function
eg: f = @(x,y,z)x+y+z x_0 = 3; y_0 = 6; g = @(z)f(x_0 ,y_0 ,z) EDIT >> g(5),g(9),g(13) ans = 12 ...

14 years ago | 0

Answered
Collecting the terms in a specific coefficient
syms a x factor(a*x^2+2*a^3*x)

14 years ago | 0

| accepted

Load more