Answered
get problem with while loop
R = [0.0016;0.0018;0.00036;0.00032;0.0005]; p=25000; Tc=25; T = Tc+(R*p);

10 years ago | 1

| accepted

Answered
find values from two matrix and save into new variable
Mix_Frac = Mix_Frac(:); Temp = Temp(:); t = Mix_Frac >= .19 & Mix_Frac <= .21; out = [Mix_Frac(t), Temp(t)];

10 years ago | 1

Answered
How to generate sequences from two vectors using rowfun
x = [1,6,12]; y = [5,10,13]; a = (min(x):max(y))'; [ii,~] = find(bsxfun(@ge,a,x)&bsxfun(@lt,a,y)); out = a(ii);

10 years ago | 1

Answered
sum of two cell arrays with different dimensions
m = numel(A); n = numel(B); C = cell(size(B)); for jj = 1:n for ii = 1:m C{jj}{ii} = A{ii} + B{jj}{...

10 years ago | 2

Answered
Comparing 2 matrix with different size
lat = flip(linspace(-23,-17 ,601),2)'; lon = linspace(54,60,601)'; l2 = [lat,lon]; B1 = B(:); [lo,ii] = ismemb...

10 years ago | 1

| accepted

Answered
Multiply cell doubles with a matrix
out = bsxfun(@times,permute(cell2mat(A),[1,3,2]),B); % out - 3D double array or out = cellfun(@(x)bsxfun(@times,x,B),A...

10 years ago | 1

| accepted

Answered
How can I multiply the columns of one matrix by another matrix most efficiently?
reshape(bsxfun(@times,B,permute(A,[1,3,2])),size(A,1),[])

10 years ago | 1

| accepted

Answered
Hey guys is it possible to write a 'for' loop for my code?
out = x(:) * l(:)'/Ltest;

10 years ago | 0

Answered
Semi-transpose a matrix
" _blocks are the matrix of 2*3_" [m,n] = size(a); p = 2; q = 3; out = cell2mat(mat2cell(a,p*ones(m/p,1),q...

10 years ago | 1

Answered
Most efficient way to sum anti-diagonal elements
"all of the elements on *_any_* NE-SW diagonal" a = randi(50,6); [m,n] = size(a); idx = hankel(1:m,m:(n-1)+m)...

10 years ago | 3

| accepted

Answered
selection of equal distances points from a set of points ?
[ii,jj] = find(triu(D == d));

10 years ago | 0

Answered
Solving linear systems with a function
R1 = 1, R2 = 4, R3 = 5, R4 = 1, R5 = 5, v = 100 R = [R1;R2;R3;R4;R5;0]; E = [zeros(5,1);v]; J = zeros(6,1); D = ...

10 years ago | 0

Answered
how to build sequential cell rows
a = [23 25 24 28 30 32]; n = max(diff(a,1,2) + 1); b = ones(size(a,1),n); b(:,1) = a(:,1); z = cumsum(b,...

10 years ago | 2

Answered
Forming a matrix based on the magnitude of a vector values
out = bsxfun(@le,rho(:),rho(:)');

10 years ago | 1

Answered
Replacing repeated elements with the index of the first element
a = [3137 3137 3137 3137 3137 3137 3137 3137 1521 1521 1521 1521 1521 1521 1521 1521 1521 1521 1521 1521 1521 1521 1521 1521 4...

10 years ago | 3

| accepted

Answered
closest index in matrix between two values
z = bwdist(X == 2).*(X == 0); [ii,jj] = find(z == min(z(z~=0)));

10 years ago | 1

Answered
how to find the index of the row
p = [1;2;3;4;5] z = [3.5,4.5] [~,out] = histc(z,p)

10 years ago | 0

Answered
how to fill a column with 1's between two specific values and with 0 otherwise?
v = [0 0 1 0 0 0 -1 0 0 1 0 0 0 0 -1 0 0 1]; z = find(v == -1); v(z...

10 years ago | 0

Answered
Find equal elements between two matrices
a=[4 3;1 2;10 11;5 7] , b=[1 3;10 21;6 6;3 7]; [lo , ii] = ismember(a(:,1),b(:,1)); out = {a(lo,:), b(ii(lo),:)}; o...

10 years ago | 2

| accepted

Answered
How to calculate normalized euclidean distance on two vectors?
out = sqrt(sum((x-y).^2)/numel(x)) or out = norm(x-y)/sqrt(numel(x))

10 years ago | 1

| accepted

Answered
Sum (rendezvous equation) in matlab
out = sum(bsxfun(@minus,x(:),x(:)'),2);

10 years ago | 2

Answered
How to extract labeled rows of a matrix?
a = {1, 2, 3, 'Sunday' 4, 5, 6, 'Monday' 7, 8, 9, 'Sunday' 10, 11, 12, 'Tuesday' 13, 14, 15, 'Monday'}; [a1...

10 years ago | 1

Answered
how to sort out files by names from a .mat file and and print the number
Please see my answer on your <http://se.mathworks.com/matlabcentral/answers/293161-dbhole-mat-contains-334-files-and-each-file-c...

10 years ago | 0

Answered
dbhole.mat contains 334 files and each file contains data of[2xn]. I want that how many 'h'(i.e h1,h2 etc) are in each 'd' (i.e d1,d2, etc)
clear load dbhole a = whos; n0 = {a.name}'; x = regexp(n0,'\d*','match'); x = x(~cellfun(@isempty,x)); x =...

10 years ago | 1

Answered
How to export data to excel
f = fopen('yourtextfile.txt'); c = textscan(f,'%s %s %s %s %s','delimiter',','); fclose(f); xlswrite('nameyourxls...

10 years ago | 1

| accepted

Answered
hello ,,, i want to remove the 2nd, 3rd,5th,8th,10th columns of this excel sheet...and get an excel sheet of only 6 columns(1,4,6,7,9,11)...
n = xlsread('adabooscore3.xls'); out = n(:,[1,4,6,7,9,11]);

10 years ago | 0

| accepted

Answered
Retrieve Spesific Row of Cell Matrix
first_row = cell_matrix(1,:); random_row = cell_matrix(randperm(size(cell_matrix,1),1),:); or random_row = cell_ma...

10 years ago | 1

| accepted

Answered
Comparing Couple of Cell Array String
data = { 'i', 'love'; 'love', 'you'; 'you', 'so'; 'so', 'much' ...

10 years ago | 1

| accepted

Load more