Answered
How to accelerate a function ?
The best way to speed up your code is to get rid of the loops. You have three nested loops. In your second loop, you keep conver...

10 years ago | 1

| accepted

Answered
colorbar to vary brightness level given a certain color hue
As you said, you want to replace the hue. So, grab the grey colour map, convert to HSV (Hue, Saturation, Value), replace the gre...

10 years ago | 1

Answered
Delete row from cell array if the difference between two cells is greater then X
You nearly got it right: rowToDelete = [JFM06CS{:,4}] - [JFM06CS{:,2}] > 6.5; I would transpose the output to get a co...

10 years ago | 0

| accepted

Answered
A question about different image size generation using Matlab
X1(end-1:end,end-1:end) Since you're using 2D indexing to index a 3D matrix, this only return values from the 1st plane (th...

10 years ago | 0

| accepted

Answered
How to make a vector linearly spaced?
As Stephen's says, your |t3| and |t| don't match because of floating point errors. You need to use a tolerance to perform the co...

10 years ago | 0

Answered
I have 6 columns of double data in .dat format, but i need to import only column 1 2 4 and 5. how do i do it
1. Use a self-describing variable name rather than |a|. 2. You don't need to delete anything to plot certain columns. Use si...

10 years ago | 0

Answered
Anon function keeps giving error
|My_Function| is already a variable of type function handle, you do not need and must not convert it into a function handle. Thu...

10 years ago | 0

| accepted

Answered
Open Files by File Name Patterns
<http://www.mathworks.com/help/matlab/ref/regexp.html regular expressions> seem like the perfect candidate. In your case: s...

10 years ago | 1

| accepted

Answered
how do you full outer join two structures based on common fields
There's nothing in matlab to do that with structures, however the newish <http://www.mathworks.com/help/matlab/matlab_prog/creat...

10 years ago | 2

| accepted

Answered
Manually picking colours from a Matlab colourmap
When you write colormap(hot); |colormap| calls the function |hot| to ask it to return the array of rgb colours to use. Y...

10 years ago | 0

| accepted

Answered
How can I delete header from a .txt file and save it?
Note: when using |fopen| always specify the permissions ('r' or 'w' mostly with optional 't' for text mode). Your code only d...

10 years ago | 0

Answered
readtable using space as unwanted delimiter
Possibly, this would work (or a variation upon it): data = readtable(file, 'Delimiter', ',', 'Format', '%s,%f,%f,%f,%s') ...

10 years ago | 1

Answered
How to find which coordinate or pixel (x,y) contains which colour intensity?
A much simpler way to save your pixels to text files would be: rgbImage = imread('C:\Users\Desktop\Documents\MATLAB\example...

10 years ago | 0

Answered
Delete rows from cell array
emptycells = cellfun(@isempty, yourcellarray); %find empty cells in the whole cell array yourcellarray(any(emptycells(:,...

10 years ago | 3

| accepted

Answered
Can someone help me in finding a way in arriving at the solution for the below problem.
You're asking for the <https://en.wikipedia.org/wiki/Cartesian_product cartesian product> of A, B and C. There are entries for i...

10 years ago | 0

| accepted

Answered
when I run this function it produces a result "NaN", what is that and why wont it give me a real answer?
Ausdemand1= -(A*2^2)/2 + (A*k*(1 + k*pa*(-1 + sigma))*2^3)/ (pa*(-3 + sigma)*(2 - 3*sigma + sigma^2)* (((1 + k*pa)*sigma*2)/(-...

10 years ago | 0

Answered
Aggregating selected variables from multiple mat files
As I've just said in <http://www.mathworks.com/matlabcentral/answers/292966-how-to-get-values-of-selected-variables-from-workspa...

10 years ago | 0

Answered
How to get values of selected variables from workspace?
The simplest way is to load your variable into a structure, simply by giving an output to |load|, then you can use <http://www.m...

10 years ago | 2

| accepted

Answered
creating an array from a txt file
The reason your |textscan| does not work is simply because the first column (the probe name) is not made of numbers so the |'%f'...

10 years ago | 0

| accepted

Answered
Data manipulation: re-organising data tables into new form of matrix
newmatrix = reshape(oldmatrix', 37, [])' Use <http://www.mathworks.com/help/matlab/ref/reshape.html |reshape|> for that. Be...

10 years ago | 0

Answered
Fill object properties from another class object
Assuming that the base class does not have a copy constructor (a constructor that simply takes another object of the base class)...

10 years ago | 2

| accepted

Answered
Moving the places of the 1's
I've not looked at your code. This is how I would implement your algorithm: %starts with A and B matrices of the same size ...

10 years ago | 1

Answered
Input: How to differntiate between numbers and strings?
You have several options: 1. Continue using |input| as is, but just wrap it in a <http://www.mathworks.com/help/matlab/ref/tr...

10 years ago | 1

| accepted

Answered
Need Help in the following code, Subscript indices must either be real positive integers or logicals?
Clearly, you need to learn <http://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html to use the debu...

10 years ago | 1

Answered
How to compare multiple strings and assign values to the comparison?
Dr. Siva Srinivas Kolukula has the right idea: use <http://www.mathworks.com/help/matlab/ref/unique.html |unique|>. His answer i...

10 years ago | 2

Answered
imerode and imopen ?
I suggest you grab a book on image processing and look up morphological operations. <https://en.wikipedia.org/wiki/Opening_(m...

10 years ago | 0

| accepted

Answered
Could someone please help me speed up my code?
See my comment to the question about the |(:, :|). The extra brackets is |x = (ACC...)| also do not help readability. To spee...

10 years ago | 1

| accepted

Answered
Replace NaN with specific value.
yourmatrix(isnan(yourmatrix)) = somevalue; But, using NaN to mark exceptional values is much better than using 0 or some ot...

10 years ago | 2

| accepted

Answered
Vectorized way to get unique strings of cell sub-arrays
If all the cell arrays in the first column are indeed all the same size, you can concatenate them into a single cell array, whic...

10 years ago | 1

| accepted

Answered
My while loop doesn't seem to end, though the expression is satisfied.
|ismembertol| is not really designed to compare just two numbers, it's more to find if a number is within the range of several n...

10 years ago | 1

| accepted

Load more