I have a variable a = 1.
I want to generate a variable name of the form:
variableNumber
so in this example, I would want
a1
a2
a3
as variables.
How can I do that?
medfilt2(img) doesn't take a map as parameter,
so I don't think it can work well with indexed image,
how do I impelemnt an median filter that can be used to process indexed images?
I would like to create some simulated historical options data, and need to calculate historical volatility from historical stock prices. Is there a built in function to do this? Any formulas?
Thanks,
CP
So let's say I have a vector p = [1 2 3]. I want a command that looks like this:
[x y z] = p;
so that x = p(1), y = p(2), and z = p(3).
Is there an easy way to do this?
I'm curious is it possible to change text properties of tick labels independently of axes properties. Do they have handles? I'd like to control their position better, alignment, color, fonts, etc.
I know I can substitute them with text labels, but it has some drawbacks. Any alternative solutions?
Particularly, is it possible to put xticklabels between ticks, that are irregular?
plot(1:100)
set(gca,'xtick',[30 45 53 70 95])
grid on
I need to put xticklabels in the middle between grids.
It's from this question?
Why the two solutions doesn't work, though it looks very valid for me:
>> t = -pi:0.1:pi;
>> r = ((sin(t)*sqrt(cos(t)))*(sin(t) + (7/5))^(-1)) - 2*sin(t) + 2 ;
??? Error using ==> mtimes
Inner matrix dimensions must agree.
>> t = -pi:0.1:pi;
>> r = ((sin(t).*sqrt(cos(t))).*(sin(t) + (7/5)).^(-1)) - 2*sin(t) + 2 ;
>> plot(r,t)
??? Error using ==> plot
Vectors must be the same lengths.
What's wrong with the above?
I have a 2-by-3 matrix, and I want to sort it according to the first column. Here's an example:
data will change to --> new data
11 33 10 22
22 44 11 33
10 22 22 44
I have this code for sorting a matrix A but it doesn't work well:
sort(A,1,'ascend');
I am writing a function to remove some values from a cellarray, like so:
function left = remove(cells, item);
left = cells{cellfun(@(i) ~isequal(item, i), cells)};
But when I run this, left has only the first value, as the call to cells{} with a logical array returns all of the matching cells as separate values. How do I group these separate return values into a single cellarray?
Also, perhaps there is already a way to remove a given item from a cellarray? I could not find it in the documentation.
So I am using the code located here:
http://wwwx.cs.unc.edu/~sjguy/CompVis/Features/BlobDetect.m
and I was wondering how to save the final blob detected image.
The image that I am doing the blob detection on gets shown and then he manually draws the lines on the image here:
Xbar = cx1+X.*cos(alpha)+Y.*sin(alpha);
Ybar = cy1+Y.*cos(alpha)-X.*sin(alpha);
line(Xbar', Ybar', 'Color', color, 'LineWidth', ln_wid);
I then want to save this image using something like imwrite. I have been reading around and it seems that no one really has an answer to to this problem.
Thanks for any help you can give me,
Josh
hello everyone, i'm just not sure how to draw the frequency response (H) of the high pass filter? after drawing the frequency response i can get the b coefficient by taking the ifft of (H).
so yeah, for a low pass filter, with a cutoff frequency of say pi/2 : the frequency response code will be H = exp(-1*j*w*4).*(((0 <= w) & (w<= pi/2)) | ((2*pi - pi/2 <= w) & (w<=2*pi));
sincr the response is "1" between 0 and pi/2 and between (2*pi - pi/2) and 2*pi.
can you help me write H for a high pass filter?
thanx in advance.
bwlabel can be used to get disconnected objects in an image:
[L Ne] = bwlabel(image);
I want to make the objects connected by adding a shortest path where necessary.
How do I approach this?
I want to remove hyphens (-), slashes (/) and white space () from a string name(i) so that I can use it as a structure field name.
This is the ugly way I am currently doing it using the function strrep:
cell2mat(strrep(strrep(strrep(name(i), '-',''),'/',''),' ', ''))
I have also tried other variations, such as:
strrep(name(i),{'-','/'},{'',''});
strrep(name(i),['-','/'],['','']);
What is a more efficient way of doing this?
In a folder, I have both my .m file that contains the script and an imaging .dcm file that needs to be analyzed.
Folder structure:
Folder1/analysis.m
Folder1/meas_dynamic_123.dcm
My script (analysis.m) begins as follows:
target =''; <== here should go the full path to the file + filename
example: /Volumes/Data/Folder1/meas_dynamic_123.m
txt = dir(target);
// etc
So I'm wondering if there is a way of when running analysis.m it will:
automatically search the folder it's in,
grab the full path + filename of file containing string dynamic in the name,
insert its full path + name into target variable
continue running the script
Does anyone have any pointers on how to achieve this? Using ffpath?
bwlabel can be used to get disconnected objects in an image:
[L Ne] = bwlabel(image);
I want to make the objects(But my target is only the contours of these objects) connected by adding a shortest path where necessary.
How do I approach this?
bwlabel can be used to get disconnected objects in an image:
[L Ne] = bwlabel(image);
How to calculate the shortest path between two disconnected closed curves?
Is there a practical(not theoretical) solution?
The unit of x-axis is hours (h), and there are 24 hours in total.
The unit of y-axis is millions (m).
How do I calculate the area under the red curve in the image in units of m*h?
Important UPDATE
Only the image is readily available (not the data), and I want to calculate the area programmatically.
bwlabel can be used to get disconnected objects in an image:
[L Ne] = bwlabel(image);
I want to make the objects connected by adding a shortest path where necessary.
How do I approach this?
Hey,
I have a matrix A which I am plotting using imagesc(A). The matrix is a 512 X 512 matrix, but I need the axes to be labeled from 0 to 4000 instead of 0 to 512. I can't seem to find where I can change this instead of just changing from where to where the points are plotted!
So that several curves X,Y can be mapped to another curve R,which is invertible so that I can still get X,Y from R.
Anyone has ideas for this or perhaps some term I can google it myself?