I want to read an image into MATLAB, draw a rectangle on it, and then save the image.
Also, I'm just learning MATLAB--please be gentle. It seems like it should be simple, but I can't seem to do it.
im = imread('image.tif');
imshow(im);
rectangle('Position', [100, 100, 10, 10]);
imwrite(im, 'image2.tif');
Even though I can see the rec...
Given two points say (1,2,3) and (4,7,8). The endpoint tangents at these points are also given as inputs say pi/4 and -pi/2 respectively. How to fit a helix of arc length 2 between these points?
How to implement this in Matlab?
...
I'm trying to solve three simultaneous nonlinear equations in the unknowns x, y, z with Matlab's symbolic toolbox. What's wrong with the following code?
solve( '(x/4 + y/2 + z/4)*(1/(8*x) + 1/(16*y) + 1/(8*z)) = 0.5774', ...
'(x/4 + y/4 + z/2)*(1/(4*x) + 1/(16*y) + 1/(16*z)) = 0.5774', ...
'(x/2 + y/4 + z/4)*(1/(8*x) + ...
Does MATLAB have a function/operator that indicates the type of a variable (similar to the typeof operator in JavaScript)?
...
Is it possible to open a worksheet in excel from matlab and edit the formulas? The idea is to automate an uncertainty analysis by creating a second sheet with the uncertainty in each cell for the value from the previous cell. Essentially, I want to treat the cells as variables and do SQRT(SUM(Partials(xi)^2)) for each cell. Matlab sho...
I am using MatLab and I have two GUIs. When I click on a push button in one GUI, the second GUI will invoke, and both GUIs both can work in parallel. If any body knows answer to this question please give reply to me.
I have two GUI forms. In the first one I am rotating a line in a circle (by using the polar function. This is for my rad...
I've often found myself doing something like this:
unprocessedData = fetchData(); % returns a vector of structs or objects
processedData = []; % will be full of structs or objects
for dataIdx = 1 : length(unprocessedData)
processedDatum = process(unprocessedData(dataIdx));
processedData = [processedData; processed...
Is there a way to determine all the dependencies of an .m file and any of the dependencies of the files it calls using a command in a script (command-line)?
There was a question like this before and it was really good because it suggested using the depfun function. BUT the issue with this was that it is outputting the MATLAB related fi...
Does anyone know if it's possible to automatically write a figure out to a .eps file in MATLAB?
I'm running a script that produces a large number of graphs, and it'd be nice if I didn't have to manually save each one!
Cheers, Ed
...
Does anyone know how I can use print to print out a file with a filename based on a variable?
At the moment if I do:
filename = 'pressure';
print -despc filename
it saves the file as 'filename.eps'
...
By numerics library I mean a library providing data types such as matrices, vectors, and common (numerical) linear algebra algorithms. Optionally FTT and statistical algorithms.
I'm primarily interested in ease of use, ideally getting much closer to Matlab in terms of expressiveness.
...
I'm trying to convert this MATLAB function into c#
but my results are not as expected.
Can anyone see where I've gone wrong?
MATLAB:
function check=CRC8(xa);
% xa is array of bits to be transmitted (column vector)
% Generates 8-bit CRC check with g(x) = x^8 + x^2 +x + 1
xae = [xa;0;0;0;0;0;0;0;0]; % Append 8 zeros to array contain...
So, I'm trying to stub a database connector in order to write tests for it. The problem is that the database connector is a pretty thin layer, and the queries to it are somewhat open-ended. I want my code to be able to ask for a variable from the database, and the connector should be OK with this. The signature for this call looks someth...
Hello,
I'm trying to program a matlab to list all permutations of the numbers 1 through n in lexicographical order. What I have so far is below. I am using recursion to try and write a program that will work for n=3 first, and then see if I can gain insight into writing the program for any n. So far I have 2 of the 6 columns for n=3: P=...
I am trying to create a function that will swap a specific number in a matrix with a specific number in the same matrix. For examlpe, if I start with A = [1 2 3;1 3 2], I want to be able to create B = [2 1 3; 2 3 1], simply by telling matlab to swap the 1's with the 2's. Any advice would be appreciated. Thanks!
...
Hi guys
I have an RGB image in MATLAB, and I want to loop through each pixel and check if it's skin coloured (ish) [I will probably do it in HSV space at a later point to negate the effects of lighting etc.]
Does anyone know the best way to do this? MATLAB's weird syntax is confusing me a little!
At the moment I have:
for x = 1:size(...
I just discovered that when calling Java from Matlab
object.method(arg1,...,argn)
is equivalent to
method(object, arg1,...,argn)
The problem here is I also have a method.m that does some translation from Java to Matlab (eg. convert String[] to cell of strings). My method.m looks like
function result = method(object, arg1,...argn)...
I am trying to implement save/load functions in a MATLAB (R2009a) UI. My object implements a layout function that generates a user interface for the object. I am trying to implement the callbacks for the save/load buttons. The save button works and save the object out to a MAT file which can be loaded later. My problem is implementin...
This question popped into my twitter stream, so I'm not so personally interested in the answer yet, but when I do need the answer, I'd expect to find it here.
The question: How do I pass a Java object as a parameter to a MATLAB function?
Specifically, I wrote a Matlab class to implement a database using JDBC and stuff from java.sql.
c...
Folks,
Matlab 2007b (7.5.0) has an avgpower function. See here:
"The avgpower method uses a rectangle approximation to the integral to
calculate the signal's average power using the PSD data stored in the
object.
"The avgpower method returns the average power of the signal which is
the area under the PSD curve."
Example invocation:
...