Answered
Changing Double to String Automatically in a Dataset Array
Here are two ways to do it: %% Method 1, using "containers.Map" ds = dataset([10;100;10;1000;100000;1;1;10000],'VarNames...

13 years ago | 1

| accepted

Answered
Matlab sometimes produce a covariance matrix error with non-postive semidefinite?
This is just caused by roundoff error. Since you know they really should be zero (and not small negative numbers), you can do th...

13 years ago | 0

Answered
using zoom in and zoom out in gui Axes
If you make a GUI in GUIDE, by default the toolbar and menubar are hidden. You can make them visible by setting the 'MenuBar' an...

13 years ago | 1

Answered
adding breakpoint to program slows it down a factor of 250x
Might I suggest using the KEYBOARD command? It's a bit simpler than setting up dbstops and trys and catches, and works just as f...

13 years ago | 2

Answered
Undefined function 'times' for input arguments of type 'cell'.
When you use INPUTDLG to get input from the user, the result is stored as a string (text) in what is known as a cell array. It i...

13 years ago | 0

| accepted

Answered
Nested Numerical Integral in Matlab
Rather than trying to do it all in one expression, it's much simpler if you break it up into two parts. Step 1. Make the inne...

13 years ago | 2

| accepted

Answered
How to constantly update a plot off of a slider being pulled
I know what you are trying to do, I often want to do the same Save the following in a file and run it to see an example: ...

13 years ago | 2

| accepted

Answered
Comparing strings in cell arrays of different sizes *Most efficient*
How about using the ISMEMBER function? Cellarray_2(ismember(Cellarray_3,Cellarray_1)) ans = 1 10 34 ...

13 years ago | 2

| accepted

Answered
how to calculate the Guass function integral within a ellipsoid?
The INTEGRAL3 function can do this quite easily. For example, for a = 2 and b = 3, a = 2; b = 3; f = @(x,y,z) exp...

13 years ago | 0

Answered
How to obtain statespace having two inputs from transfer function in matlab mfile
How about: s = tf('s'); G= (s^2+s+1)/(s^4+s^3+s^2 ); Gss = ss([G G]); Although I don't quite see the point i...

13 years ago | 0

Answered
Bicubic Interpolation on Scattered Data
Do you have the Curve Fitting Toolbox installed? That does support 3rd order interpolation from scattered data points: F = ...

13 years ago | 1

Answered
Nonlinear fit of segmented curve
It is no problem to fit piecewise curves in MATLAB using the Curve Fitting Toolbox. You can deal with piecewise functions by mul...

13 years ago | 1

| accepted

Answered
Descriptive Statistics Function for a Dataset Array
Perhaps you could write a simple routine using the DATASETFUN function to calculate all the stats you wanted? For example: ...

13 years ago | 0

Answered
Extreme gain for low pass filter
I don't think that is a weird bug. That large value looks correct to me. The DC gain should = 1. In other words, if you plug ...

13 years ago | 0

| accepted

Answered
ODE45 stop after all events have fired
One way of doing this would be to call the ODE solver repeatedly in a loop, until you find that all particles have set off event...

13 years ago | 1

Answered
linear interpolation of matrix.
This is a method that will preserve area. %Step 0. Just making some random data to work with... R = rand(2209,32); ...

13 years ago | 0

| accepted

Answered
How to set the default value for Edit Text in GUI ? If not input a number , I hope the contents auto changed to be '5'
STR2DOUBLE returns NaN for non-numeric data. Instead of checking for empty input using ISEMPTY, use ISNAN instead. if isnan...

13 years ago | 0

| accepted

Answered
How do you create a surf plot in cylindrical coordinates?
You can use POL2CART to convert the data from r/theta to x/y and then call SURF. [R,TH] = ndgrid(0:0.1:5,linspace(0,2*pi,41...

13 years ago | 0

Answered
Area between a curve and a baseline
You could try something along the lines of this: % Just making some data x0 = 0:0.001:5; y0 = sin(x0); plot(x0...

13 years ago | 0

Answered
Quick way to change complex number into NaN
A(imag(A)~=0) = nan;

13 years ago | 3

| accepted

Answered
i want to display binary image in blue color...
You can change the colormap to contain blue and white. Like this: I = im2bw(imread('cameraman.tif')); imshow(I) colo...

13 years ago | 1

| accepted

Answered
Any way to stack histograms?
Can you use the 'stacked' option, as described in the help for BAR? bar(rand(10,5),'stacked'), colormap(cool)

13 years ago | 0

Answered
Matlab MODE-like function for evaluating multimodal sets of data?
One fairly simple way to do it: A = [1,2,3,3,5,2,7,7]; U = unique(A); H=histc(A,U); U(H==max(H))

13 years ago | 1

| accepted

Answered
For loop Nested Loop
Why do you want to do this by brute force? You will have to test 12^11 combinations, which is quite a lot. I don't know what you...

13 years ago | 0

Answered
Vectorizing nested loops ---- indexing problem
The sorts of operations you are doing, where you sweep one vector through another, multiply and then add them, can be done very ...

13 years ago | 0

| accepted

Answered
Do I need to add a column of ones on the predictor matrix for use in LinearModel.fit(X,y)
By default, LinearModel.fit also includes a column of ones. For example X = rand(10,2); y = 3*X(:,1) + 4*X(:,2) + 5*X...

13 years ago | 0

| accepted

Answered
Finding the roots of a function gotten from using ODE45
Not as painless as Matt's way, but possible a bit more robust, since it uses the ODE solver's internal zero-finding capabilities...

13 years ago | 1

Answered
I want to solve a sinus equation.
You're just forgetting the apostrophes solve('b*sin(c)=d*sin(x)') ans = asin((b*sin(c))/d) pi - asin((b*sin(c...

13 years ago | 0

Answered
Adding matrix elements (entering matrices into other matrix)
How about: A(2:3,2:3) = A(2:3,2:3) + C

13 years ago | 0

| accepted

Answered
date for release of Matlab 2012b general release
There you go: <http://www.mathworks.com/index.html> <http://www.mathworks.com/products/matlab/whatsnew.html>

13 years ago | 4

Load more