Answered
Undefined function or variable error
Both commands are part of the image processing toolbox. Maybe you have not installed this toolbox in your current version? To ch...

9 years ago | 0

| accepted

Answered
Concatenate arrays horizontally n matrix by loop
A(:,:,1) = [1 2 3; 2 4 6]; A(:,:,2) = [4 5 6; 8 10 12]; A(:,:,3) = [7 8 9; 14 16 18]; A(:,:,4) = [10 11 12; 20 22 24]...

9 years ago | 1

Answered
choose and change data partially
theta = linspace(0, 2*pi); idx1 = theta >= pi/2 & theta <= 3*pi/2; idx2 = theta >= 3*pi/2 & theta <= 2*pi; theta...

9 years ago | 0

Answered
Generate numeric code based on string value
c = {'a_abc_ABC', 'a_def_ABC', 'b_def_ABC', 'a_abc_ABC', 'a_def_ABC'}; [~, ~, c_num] = unique(c);

9 years ago | 1

| accepted

Answered
remove duplicate rows from a matrix
unique(sort(A,2), 'rows')

9 years ago | 0

| accepted

Answered
Can I call functions inside a parfor loop?
If the results of the computations in the loop are independent of each other, you can use parfor.

9 years ago | 1

Answered
having problem to call m.file
You can use switch to compare a string variable to different other constant strings: switch exparx case 'expfun1cfd' ...

9 years ago | 0

Answered
Replacing values in a Matrix
[Aval, ~, indAval] = unique(A); Define the new values. Values are ordered from the smallest value to replace with to the lar...

9 years ago | 3

Answered
How can I read a text file and then take out specific words in that text file?
fid = fopen(filename); T = textscan(fid, '%s'); T = T{1}; fclose(fid); idx = strcmp(T, 'word_to_take_out'); N...

9 years ago | 0

| accepted

Answered
Why do I get wrong results with power of 2?
Use .^ M = [1 2; 3 4]; 1.61803.^M

9 years ago | 0

Answered
how to do a command line only if it is possible?
if exist('previous_setting') end If previous_setting is variable, use exist('previous_setting', 1) if it is an...

9 years ago | 1

| accepted

Answered
Searching for line and circle intersection.
If P11 and P12 are the intersection points with circle 1, and P21, P22 are those with circle 2, you compute the distances betwe...

9 years ago | 2

| accepted

Answered
How to bin 2d data?
Have a look at this: D = dlmread('/Users/hansen/Downloads/PC1-PC2.txt'); Nbins = 37; H = hist3(D, {linspace(-3,3,Nbi...

9 years ago | 0

Answered
How can I automatically adjust the radius of concentric coronas? code is given below
You can considerable simplify the plotting of the nodes x = 10:10:100; % x = 0.1:0.1:1; % uncomment to choose a differen...

9 years ago | 0

| accepted

Answered
Drawing circles with multi-colored patterns in the annulus
You can generate your circles using my function plot annulus plotannulus(0, 0, 5, 10, [0 0 1; 1 1 0], deg2rad(90)) plota...

9 years ago | 1

Answered
Udefined function or method 'FLOPS' for input arguments of type 'double'. Error in ==> expfun1cf1 at 4 FLOPS(0);
<https://www.stat.uchicago.edu/~lekheng/courses/302/flops/>

9 years ago | 0

Answered
how to check if the row of the matrix equal zero or not
k=m; k(all(m==0,2),:)=[] % delete that row and create new vector (k)

9 years ago | 0

| accepted

Answered
memory and large arrays
If you clear the variables that you do not need Matlab will less likely run out of memory. But if you don't have memory issues, ...

9 years ago | 0

Answered
In a cell how do I extract a specific range of values from a few columns that have a certain value in another column?
You can also achieve this without accumarray or splitat, using a for-loop. c ={'Bob', 1, 100; 'Bob', 3, 200; 'Bob', 4, 500; ...

9 years ago | 2

Answered
Error using function: Not enough input arguments.
You have to call the function with an argument n: >> myfirstmatlab(4) Note that you can write your program in a single li...

9 years ago | 0

Answered
get the correct data of intersection in plot
You can compute the first intersection of each curve with a horizontal line of height 95. There are various ways to compute inte...

9 years ago | 0

Answered
Why does changing ydir to 'reverse' change xdir and axis locations, but not ydir?
Probably you messed up the first and the second plot. gca may give you the axes of the right plot, and then you try to reverse t...

9 years ago | 1

| accepted

Answered
how to convert Decimal degree to degree minutes decimal?
degdegree = 32.533; % sample value deg = fix(degdegree); mindec = 60*(degdegree- deg); if deg > 0 NSstr = 'N...

9 years ago | 0

Answered
how to find maximum and minimum in a matrix
A= [0.1 0.5 0.3 0.9 0.4 0.8 0.4 0.2 1 0.7 0.2 0.6 0.7 1 0.2 0.9] idx = A(:,1)==max(A(:,1)) ...

9 years ago | 1

| accepted

Answered
Convert Minutes to Seconds
The help of minutes tells us If X is a numeric array, then M is a duration array in units of minutes. If X is a duration...

9 years ago | 0

| accepted

Answered
what exactly this Logical indexing refering to?
When you ask for [C{logical([1 1]),:}] which is the same as [C{:,:}] you ask Matlab to combine variables of unlike classes, name...

9 years ago | 0

Answered
Is the equality min(a/(b+1), c/(d+1))=min(a,c)/(min(b,d)+1) hold?
It does not hold. Try a = 1; b = 8; c = 4; d = 3; min(a/(b+1), c/(d+1)) min(a,c)/(min(b,d)+1),

9 years ago | 0

| accepted

Answered
How do I remove outliers from a matrix?
idx = bsxfun(@gt, R, mean(R) + std(R)) | bsxfun(@lt, R, mean(R) - std(R)); idx = any(idx, 2); R(idx, :) = [];

9 years ago | 1

Answered
Splitting up and N size array into parts
N = 613; P = 10; X = rand(N, 1); r = diff(fix(linspace(0, N, P+1))) C = mat2cell(X, r, 1)

9 years ago | 0

| accepted

Load more