Question


Use of a user defined pointer to mxArray.
This has always bugged me about working with MEX-functions. Here is how I always end up working with the return argument from a...

15 years ago | 1 answer | 1

1

answer

Answered
Changing the boundary rows and columns.
A = [1,1,1,1; 1,1,1,1; 1,1,1,1]; A([1,end],:) = 0; % Changes the first and last row. A(:,[1,end]) = 0; % Changes the fir...

15 years ago | 0

| accepted

Answered
Matlab 7.1 in Windows Vista: Error starting desktop when open Matlab
I am running 7.0.1 on WinVista no problem. I do use an Intel cpu, but I can't imagine that would matter. Do you need to updat...

15 years ago | 0

| accepted

Answered
error using text()
Works here: clear all,close all,clc R_squared = .5; x_pos=0.0031; y_pos=0.0507; str_=['R^2 (%) = ' num2st...

15 years ago | 1

| accepted

Answered
How to find the loaction of an element in an array
T=[0 1 2 3]'; Q=[100 200 300 400]'; Q_T = Q(T==2) % Or, Q(find(T==2)), but not as efficient... Be aware that if you...

15 years ago | 1

| accepted

Answered
Plot updated only after opening the PropertyEditor and mousebutton on object
p = getoptions(h); p.Responses.Style.Markers = 'o'; p.Responses.Style.LineWidth = 3; setoptions(h,p); Assuming th...

15 years ago | 0

Answered
Dynamic fieldnames
Your code is a little confusing because it doesn't appear that you are assigning anything to the structure. Here is code that d...

15 years ago | 2

| accepted

Answered
Drawing a segment of a circle
Here is another function to do it. It returns the handle to the patch object so that the color can be set or whatever. fun...

15 years ago | 6

Answered
Different For Loop Comparison
Of course the values are not the same! C is a char but E is a double. Also, you say you reshaped C but you didn't do it in the...

15 years ago | 0

| accepted

Answered
value of the pixel
That would depend somewhat on the datatype, and how exact you want to be in calling something black. Do you want a tolerance? ...

15 years ago | 0

Answered
Preallocation of data
Is this just the same question you have asked twice before? If not, you need to include more code. For example, pre-allocation...

15 years ago | 1

| accepted

Answered
regarding plot function
If the axes in g2 is the only axes you have open, you could use: plot(findall(0,'type','axes'),x,y) This goes in the callbac...

15 years ago | 0

| accepted

Answered
Calculating Mean inside a loop
Use <http://www.mathworks.com/help/techdoc/ref/histc.html HISTC> for binning problems. See both the one and two output function...

15 years ago | 0

Answered
Axis tick labels changed upon export to EPS
I only use this for exporting figures. <http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig Export_fig>

15 years ago | 0

Answered
I cannot run an .m file containing script directly in command line
You don't say what happens when you try to run the script, but I suspect that the script is not in your new default directory fo...

15 years ago | 0

Answered
How do I solve this equation for x given a value of z and y?
Re-write the equation as: f = @(x)(10.^(-15).*x.^(3).*exp((x.^2).^(-1)/4).*y.^(-1)).^(1/5)-z Then let <http://www.mathworks....

15 years ago | 0

| accepted

Answered
trouble to run a file directly from current directory
You have been naming M-files with the same name as built-in functions. Now you see the reasons why this is not recommended. To...

15 years ago | 0

| accepted

Answered
str2double:getting rid of the decimal points
format long g A={'2248866001' '2249926001' '2249924001' '2249925001' '2249906001'}; str2double(A) ...

15 years ago | 1

| accepted

Answered
dates with yy
datenum('08/28/01')

15 years ago | 0

| accepted

Answered
What evaluates to "true" in matlab?
For the first part of your question, IF statements on vectors evaluate to true only if all of the elements in the vector would e...

15 years ago | 2

Answered
Suggestion for rewrite of the for loop and while loop
The major improvement will come from Pre-allocating memory for Video instead of growing the data in the loop. Calculate the fin...

15 years ago | 0

| accepted

Answered
GUI calendar
In the code you must have put in a hard value for the date. Instead, use the DATE function. str = date; figure('numbert'...

15 years ago | 0

| accepted

Answered
plotting anonymous functions with multiple variables
This is confusing to me. If I plot your vectors: plot(cfm,h20) It doesn't look cubic, though you could fit a cubic polynomi...

15 years ago | 0

Answered
How to define a structure fieldname from a cell contains a string value?
Instead of using EVAL, use dynamic fieldnames.... select = [{'NAME'}, {'VALUE'}; {'alpha'}, 0.4; ...

15 years ago | 1

| accepted

Answered
3D Box Plotting
I don't know what you mean by "the ascent." But you could look around at the properties of the surface object and see if settin...

15 years ago | 0

Answered
Two Questions: Timer and Sound
Here is an example, adapt it to your needs. function [] = timer_examp() S.fh = figure('units','pixels',... ...

15 years ago | 0

Answered
Suggestions for my code
When doing element-by-element computations, use .* .^ and ./ clear [x t]=meshgrid(0:5*10^(-5):200*10^(-5), 0:10:400);...

15 years ago | 0

Answered
using Tisean with matlab
Did you download the <http://www.mpipks-dresden.mpg.de/~tisean/archive_3.0.0.html source code>? It doesn't help those who would...

15 years ago | 0

| accepted

Answered
Some Syntax Error
You are running code which was written in a newer version of MATLAB. Your version does not recognize the tilde being used this ...

15 years ago | 1

| accepted

Answered
summing the ith frequencies with the ith amplitudes^2 from a spectrogram of a Harmonic
It is not the vector that is being squared, but each component. A = [1 2 3 4]; A.^2 % Notice the '.' - it matters! % %...

15 years ago | 0

Load more