Answered
Create a new variable when conditions are met
temp = [10 2; 20 2; 30 1; 40 2; 50 1; 60 3]; G = temp(temp(:,2) == 2, :); M = temp(temp(:,2) == 1, :); If you like to ...

11 years ago | 1

| accepted

Answered
Convert array initialization code
You're right, the code adds a zero in front of vector v or a zero column if v is a matrix.

11 years ago | 0

Answered
I there any built in tool in MATLAB that perform Principle Component Analysis?
Matlab's PCA is called princomp You can find out using lookfor principal Which results in my system in ...

11 years ago | 1

| accepted

Answered
Undefined variable "handles"
The variable 'handles' is not known inside your function set_row. You have to define set_rows with an additional parameter 'hand...

11 years ago | 0

| accepted

Answered
Extracting values from incomplete matrix set
Just check if the file exist before loading rank1 = nan(155, 2); % preallocate for speed for k = 1:2 for j = 1:155 ...

11 years ago | 0

Answered
Why does MATLAB display font type "Helvetica" differently on Linux OS?
There is some art and science involved in how a font is displayed best on a monitor, a process known as hinting. Different OS ...

11 years ago | 1

Answered
How do you save while loop output in a vector?
You don't have to introduce Hc or Fc; the data are already stored in F and H, as in the following example t = 1; while t <...

11 years ago | 0

Answered
Easily working with numerical data in a cell array
A{1} = rand(12,2); A{2} = rand(10,2); b) B = cell2mat(A'); a) plot(B(:,1), B(:,2))

11 years ago | 0

| accepted

Answered
Plot Matrix with 3 columns
The mistake is that your script contains only comments, but no commands. It should read % Auto-generated by MATLAB on 22-Jul...

11 years ago | 0

Answered
To run a function
You can call a function w/o the square brackets in front, but then you only get the first return value in ans, as David explaine...

11 years ago | 1

| accepted

Answered
How can i randomly move the values of a vector
X = X(randperm(numel(X));

11 years ago | 0

Answered
Merging files with different dimensions
You can reshape T into a 3D matrix of size 10x 6480x 33: T = reshape(T, 10, 6480, 33);

11 years ago | 0

Answered
I try to apply fuzzy c mean clusturing for landsat 8 image. I want to apply for a rgb image. This code can only apply to the one band.. How can apply this code for all bands.
Write a function that runs the code in one band: Y = fuzzycmc(I); and call this function for every band.

11 years ago | 0

Answered
Loading data from a dat file without headers
Use textread with 'headerlines', 10.

11 years ago | 0

Answered
How to remove rows in a multidimensional matrix?
for k=1:size(A,3) Ak = A(:,:,k); B(:,:,k)= Ak(sum(Ak')~=0,:); end

11 years ago | 0

| accepted

Answered
Can everyone help me to correct my code?
There is no plot command plot(rp, tp)

11 years ago | 1

Answered
colon operator rounding problem
Use a = linspace(0, 120, 1201); But in general don't use a(20) == 1.9 but abs(a(20) - 1.9) <= eps If yo...

11 years ago | 0

Answered
Extracting near constant elements from an array
First who have to define an formal criterion of what you consider "near constant". For example, more than 20 points that vary my...

11 years ago | 1

Answered
How do i get index of a closest value from an array?
N = round(max(a)/900); for i = 1:N, [~, ind(i)] = min(abs(a - 900*i)); end

11 years ago | 0

Answered
How to add multiple axes to a log-log plot?
You have to set the xscale and yscale property of ax2 to 'log': x1 = 1:1000; y1 = x1.^2; x2 = 2*x1; y2 = y1; lo...

11 years ago | 0

| accepted

Answered
i am geeting an error as "??? Input argument "int_H" is undefined.
You have to evoke the function with argument in the same order as you have defined the function. You define the function with H_...

11 years ago | 0

Answered
How to add multiple axes to a log-log plot?
See http://www.mathworks.com/matlabcentral/answers/54258-plotting-two-loglog-y-axes

11 years ago | 0

Answered
How to fix a bug with 'sum' function?
Check which sum at the start of your script and immediately before the line that generates the error. Must always be 'bu...

11 years ago | 0

Answered
how will be mean brightness of color image will be formulated in matlab
If you have an Lab image as a 3D matrix with planes L, a, b, just use meanbrightness = mean2(Lab(:,:,1)) If you have an ...

11 years ago | 0

| accepted

Answered
how to correct thismistake
Check whos Route n = length(Route) BTW, if you need just one value, you can use randi(n, 1)

11 years ago | 0

Answered
Is there a way to use a median style filter to reduce spikes over a certain amplitude?
HR=[136 137 138 140 141 142 143 143 144 144 145 146 160 144 143 143 142 143 143 144 145 146 145 148]; dHR = diff([HR(1) HR]) ...

11 years ago | 0

Answered
How to find common centroids?
I is not exactly clear to me what you want to achieve. To order C depending on distance to the mean: C{1} = []; C{2} =...

11 years ago | 1

Answered
Scanning folder for files and using specific function for each of them.
1) filename1 = listSmartPhone1(i).name; 2) n = sscanf('2015-06-13_08-38-21.csv', '%d-%d-%d_%d-%d-%d'); 3) fu...

11 years ago | 0

| accepted

Answered
store data in matrix
Growing matrices slow down your program, so preallocate M: Nhours = 7; M = ones(Nhours*3600, 9); Have a look at it's s...

11 years ago | 0

Answered
Is it possible to plot the ticks but not the axes?
No, but you can draw a white line on top of the axes. Or you can use my function onlyticks function onlyticks %ONLYTI...

11 years ago | 0

Load more