Answered
Setting X as a column of a matrix
Use a FOR loop to loop over the rows of column 2. But you are going to want to *define* A,B,C,D,F or you will get errors. Unle...

13 years ago | 0

| accepted

Answered
Question about 'save' option for workspace variable saving
It always helps to read the help. If you do, you will see something like this: save(filename,variable) So, save('...

13 years ago | 2

Answered
Some basic MATLAB questions
Another one-liner (short!): % x is the unknown numerical grade. G = char(65+sum(x<.5+[59 59:10:89])); As it stands it...

13 years ago | 2

Answered
Some basic MATLAB questions
As per requested: % x is the numerical unknown grade G = char(interp1([-inf,59,60,69,70,79,80,89,90,inf],['FFDDCCBBAA'],...

13 years ago | 3

Answered
Passing two subfunction variables in GUI to another function
You add to handles, but then do not save handles. See the help for GUIDATA.

13 years ago | 0

Answered
Some basic MATLAB questions
X = round(rand*6) if X<3 disp('Small X') elseif X==3 disp('X is 3') elseif X>=3 & X<5 disp('Me...

13 years ago | 0

| accepted

Answered
Axes WIndows in Guide Disappearing
What do you mean by 'switching between' the axes? Just to be clear, in MATLAB a window is called a figure. So do you mean you ...

13 years ago | 0

| accepted

Answered
choosing from numbers whose sum is X
I suppose you mean integers, but you don't say.... N = round(randn(1,1000)); S = 0; maxiter = 2e6; cnt = 1; ...

13 years ago | 0

| accepted

Answered
Error: Unable to locate 'mexopts.bat'
I would suggest you follow the advice of the error message! Type this at the command line: mex -setup

13 years ago | 2

| accepted

Answered
combining information of 2 cells
ref = {{'m3m1f1';'y9h5g5';'u8h1h5'}; {50.00;50.44;30.98}}; A = {'y9h5g5';'m3m1f1'}; [J,J] = ismember(A,ref{1}); % Or A{...

13 years ago | 0

| accepted

Answered
Run .m script from GUI
You don't need to type run. Just the name of the script will cause the script to execute.

13 years ago | 0

| accepted

Answered
Help with while loop
You were pretty close, but there are a couple of mistakes. # You start out the error at zero, then ask the loop to run onl...

13 years ago | 0

| accepted

Answered
How can I label the same line using different color
One way to get the effect is to use two lines. a = 0:0.01:2*pi; b = sin(a); b2 = b; b(b<=0) = nan; % nan values ...

13 years ago | 0

Answered
not urgent, but if you see this and have time please help me, thank you , Please help , LAST prime under n
O.k., you gave it a good shot, but there are some simple mistakes here. You want to use the ISPRIME function, but you define a ...

13 years ago | 0

| accepted

Answered
Generating index from end and start index
If you don't want to use a mex file, this is very fast: % Make your index into A L = length(s); F = cumsum(e-s+1); ...

13 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #2 (and bug reports)
I wish the answers software would automatically delete the tag: MATLAB.

13 years ago | 2

Answered
Split a matrix into smaller pieces - help
A = reshape(1:36*16,16,36); B = mat2cell(A,[4 4 4 4],36); Now you have each submatrix stored in a cell of B. For exampl...

13 years ago | 1

| accepted

Answered
How to display non-zero part of a curve
I assume when you say that you want to "display the non-zero values" you mean you want to "plot only the non-zero values." ...

13 years ago | 1

| accepted

Answered
Remove every second tick on y-axis
set(gca,'ytick',0:.2:1)

13 years ago | 1

| accepted

Answered
[HELP] A Classical Numerical Computing Question
No, they shouldn't be the same at the fringes. This is an example of why we often have to look for more stable ways of doing in...

13 years ago | 0

| accepted

Answered
Problems with Conditionally execute statements
<http://blogs.mathworks.com/loren/2012/06/15/whats-if-all-about/ If statements do not pick out elements of arrays>! for ...

13 years ago | 0

| accepted

Answered
How do I use the who command within a function
When a function is running, the current workspace is the workspace of the function. That is just how it works. Why not jus...

13 years ago | 0

| accepted

Answered
how to increase the height of sublpot?
Did you try two rows and four columns? This might be better if your monitor is wider than tall, like mine. Other than that, ju...

13 years ago | 0

Answered
why does transposing a sparse matrix change its memory requirements
Yes, MATLAB uses compressed column storage, not compressed row storage. Notice: >> x = sparse(zeros(1,10000)); >> who...

13 years ago | 0

Answered
How to make script to function for sprintf command
There are several problems. For one, you don't specify any return argument for your function. Try this one: function na...

13 years ago | 0

| accepted

Answered
How can to convert this following cell to single matrix
O.k., here is an example. First I will build a cell array as you show, then I will get it to matrix B. % First build you...

13 years ago | 0

Answered
Passing Parameters from GUI to Script
If _setup_ is a script, you are actually running it from in the callback. If that is o.k., try this: function Go_Callback(...

13 years ago | 1

| accepted

Answered
How to obtain the row and column indices of a "bsxfun" matrix
Use <http://www.mathworks.com/help/matlab/ref/ind2sub.html IND2SUB> or <http://www.mathworks.com/help/matlab/ref/find.html FIND>...

13 years ago | 0

| accepted

Answered
For loops and taylor series
Use this loop instead: for k = 0:n approxValue = (approxValue + x.^k/factorial(k)); % Gives the approx valu...

13 years ago | 0

| accepted

Answered
How to create variables in the command prompt space using a function
First of all, comments in MATLAB are given by %, not //. Second, which function are you calling first, and from where, and wh...

13 years ago | 0

| accepted

Load more