I'm trying to write some code to calculate a cumulative distribution function in matlab. When I try to actually put my results into an array it yells at me.
tempnum = ordered1(1);
k=2;
while(k<538)
count = 1;
while(ordered1(k)==tempnum)
count = count + 1;
k = k + 1;
end
if(ordered1(k)~=tempnum)
o...
Hi, I'm a bit new to MATLAB.
Basically, I have a 20x20 values , complete with various random entries ranging from 0 to 3. I need to write a program that reads this 20x20 square, and assigns x-y coordinates to the entries, so that when I ask for an input of a particular x-y coordinate which has, say an entry of 3, then it will result in...
I have a GUI which uses a selection from a popupmenu in another callback. Is there a way to return the selected value of the popupmenu in only one line without creating any temporary variables? I've tried several solutions, but I've only managed two lines with one temporary variable:
Three lines:
list=get(handles.popupmenu1,'String');
...
Hi everyone,
I've written this code which makes an animation of 2 ellipsoids. Parameter k1 of these ellipsoids must depend on time (so they'd move asynchronously), but I need to animate them in one figure. Can I use loop for it or is it better to use timer & some kind of callback functions? The second problem - I need to move inner elli...
I have a class called forest and a property called fixedPositions that stores 100 points (x,y) and they are stored 250x2 (rows x columns) in MatLab. When I select 'fixedPositions', I can click scatter and it will plot the points.
Now, I want to rotate the plotted points and I have a rotation matrix that will allow me to do that.
The...
When you're using Haar-like features for your training data for an Adaboost algorithm, how do you build your data sets? Do you literally have to find thousands of positive and negative samples? There must be a more efficient way of doing this...
I'm trying to analyze images in matlab (not faces) and am relatively new to image processing...
Hello I have been trying to display the dimensions of a dataset, below is the following matlab code that i used...but it gives me the wrong output....i'e number of rows and columns values are wrong....any help regarding this issue would be highly appreciated
[file_input,pathname] = uigetfile( ...
{'*.txt', 'Text (*.txt)'; ...
'...
Is there a method to detect the value of a image rgb that is blury?
I simply want to store the blury value of my image in a variable called blury value? Is there a dedicated function?
%image1 which is rgb is stored in variable img1
img1 = imread('102.jpg');
% conversion to grayscale stored in img1_grey variable
img1_grey = rgb2gray(...
I have a variable in the MATLAB workspace and I want to pass the variable name and its contents to a function in my GUI.
How do I achieve this task?
...
I tried using uiimport to load a file to the base workspace.....It worked first time....but after trying again after a while...I wasnt seeing the variable in the base work space.
I used the default variable name which is given by 'uiimport".
This was the command I used:
uiimport(filename)
And two variables where created by default.....
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) + ...
I have an input data in Excel which has 2000 rows and 60 columns.
I want to read this data into MATLAB but I need to to interchange the rows and the column so that the matrix will be 60 rows and 2000 columns. How can I do this in MATLAB, because Excel only has 256 column which cannot hold 2000 columns.
...
Hello:
I have an extremely bizzare situation: I have a function in MATLAB which calls three other main functions and produces two figures for me. The function reads in an input jpeg image, crops it, segments it using kmeans clustering, and outputs 2 figures to the screen - the original image and the clustered image with the cluster cent...
I want to generate a binary mask that has ones for all voxels inside and zeros for all voxels outside a volume. The volume is defined by the convex hull around a set of 3D coordinates (<100; some of the coordinates are inside the volume).
I can get the convex hull using CONVHULLN, but how do I convert that into a binary mask?
In case t...
I googled near and far, but couldn't get an example of how you associate a callback to the click event in matlab. Can someone show me an example?
...
If I get coordinates via
coords = get(0,'PointerLocation');
How can I convert them into points gotten via ginput?
i.e, I would like to get the same values from
coords = get(0,'PointerLocation');
coords=someConversion(coords);
As I would have gotten by calling
coords=ginput(1);
And clicking inside the figure in the same spot a...
I have a map of individual trees from a forest stored as x,y points in a matrix. I call it fixedPositions. It's cartesian and (0,0) is the origin.
Given a velocity and a heading, i.e. .5 m/s and 60 degrees (2 o'clock equivalent on a watch), how do I rotate the x,y points, so that the new origin is centered at (.5cos(60),.5sin(60)) and...
Right now in Matlab (0,0) is the origin, 0 degrees / 2pi would be to the right of the cartesian plane and angles are measured counter clockwise with 90 degrees being at the top.
I'm trying to write a simulator where the coordinates would match a compass bearing. 0/360 degrees or 2pi would be at the top and 90 degrees would be on the ri...
Hey, having a wee bit of trouble. Trying to assign a variable length 1d array to different values of an array, e.g.
a(1) = [1, 0.13,0.52,0.3];
a(2) = [1, 0, .268];
However, I get the error:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> lab2 at 15
a(1) = [1, 0.13,0.52,0.3];
I pre...
In MATLAB how do you plot
f(r) = { 2*J1(a*r) / r }^2
where a = 2*pi
and J1 is Bessel function of the 1st kind
and r = sqrt(x^2 + y^2)
This should plot in 3D, i.e. kind of be like a bubble (not sure how to do this)
...