Respondida
Plotting functions
MATLAB Answers is a place you can get help from the user community on specific MATLAB questions. It is not intended as a place ...

alrededor de 15 años hace | 1

Respondida
if i have matrix x is 4 by 5, how can I retrieve the the row number and save it into y
y = size(x,1)

alrededor de 15 años hace | 0

| aceptada

Respondida
Need help With "If" statement
Do you want that to be an error condition? In which case |error('no')| (in place of |disp|) will display the message and termin...

alrededor de 15 años hace | 0

Respondida
Numerical integration while keeping the parameters
Or, if it's actually a function of x with two parameters, and integrated over a fixed interval, then a variation of Andrew's ans...

alrededor de 15 años hace | 1

| aceptada

Respondida
Problem keeping input file in the same order using textscan
Ahahahahaha! I'm gonna take a bet that price(1) is actually the price from the 49th row, right? You'll love this. Instead o...

alrededor de 15 años hace | 2

| aceptada

Respondida
Output from handles instead of globals
If these functions all live in the same file, the simplest way to pass data around is to use nested functions. A nested functio...

alrededor de 15 años hace | 0

Respondida
Need help with Plots
Or is the problem that the colors should cover the whole map (instead of a small box in the middle)? In which case the problem ...

alrededor de 15 años hace | 0

| aceptada

Respondida
Need help with Plots
It's hard to tell exactly from the image, but it looks like maybe it's just the lines that make it look like a black box. Try t...

alrededor de 15 años hace | 0

Respondida
Create a function to find the average of an entire matrix only using loops
Why the requirement for a loop? The neatest way to do this is: mean(x(:)) But if you really want a loop, function ...

alrededor de 15 años hace | 0

Respondida
Summing across columns
Just a simplification to Paulo's version -- "plot against the first column" means plot the sum as y and the first column as x: ...

alrededor de 15 años hace | 1

Respondida
Having Trouble Plotting 4D data
I concur with Andrew about the code. Another diagnostic you could use is to visualize a series of slices: figure for k = 1...

alrededor de 15 años hace | 0

Respondida
How do I keep a handle and use FINDOBJ to get a handle again?
What Matt Fig said, plus: are you actually copying the number in (rather than saving it in a variable and passing the variable i...

alrededor de 15 años hace | 3

| aceptada

Respondida
Segmented Sinewave
Something like this? p = 3; t = linspace(0,10*p,201); tseg = p*[0 1 4 5:9]; n = length(tseg)-1; y = sin(2*pi*t)...

alrededor de 15 años hace | 0

Respondida
Is cellfun multithreaded or does it do the operation one cell at a time?
Currently |cellfun| is not multithreaded.

alrededor de 15 años hace | 3

Respondida
Problem with conditional code and missing data
You can use size -- note: |size(x,1)| returns the number of rows [dimension 1], and |size(x,2)| returns the number of columns [d...

alrededor de 15 años hace | 0

Respondida
What do you like about MATLAB?
\ It takes getting a little used to, but once you grok it... ( |/| too, but it's not as useful as |\|). The fact that it h...

alrededor de 15 años hace | 0

Respondida
clear one plot in multiple (hold) figure
In addition to the cyclist's answer, you can also do delete(h2) to actually delete the line, rather than just hide it. ...

alrededor de 15 años hace | 50

Respondida
What do you like about MATLAB?
Logical indexing is proof that Cleve loves us and wants us to be happy. Eg, goodbye outliers: x(x > val) = [] Or stats ...

alrededor de 15 años hace | 6

Respondida
Calculate derivatives on the interval 0<x<2pi using forward, backward, centered, and fourth order accurate finite differences
First, those |for| loops are making Baby Cleve cry. They can all be replaced with vectorized expressions ( |f = a*x + b*x.^2 +|...

alrededor de 15 años hace | 0

| aceptada

Respondida
[DISCONTINUED] Wish-list for MATLAB Answer sections.
An automated email: "Dear [user], than you for using MATLAB Answers. Your question "[title]" now has [num_ans] answers. If any...

alrededor de 15 años hace | 7

Respondida
Multiple f(x) values for a 2D graphic
For more than two y axes, you could try <http://www.mathworks.com/matlabcentral/fileexchange/4425-ploty4-m ploty4.m> or <http://...

alrededor de 15 años hace | 0

Respondida
What programming challenges would you pose to new users?
Several of the problems at <http://projecteuler.net/index.php?section=problems Project Euler> have made me think about new ways ...

alrededor de 15 años hace | 1

Respondida
Finding minima
If you want fancy, take Walter's advice and search FEx. If you want quick and dirty: x = 1:50; y = sin(5*x); idx = [...

alrededor de 15 años hace | 4

| aceptada

Respondida
Can I get side-by-side-by-side barh on one axes?
What you've suggested already seems to solve the problem. So is the real issue that you've had to hack the values to start at 1...

alrededor de 15 años hace | 0

Respondida
Read file
Or, using |textscan| (as Jan mentioned): FID = fopen(FileName, 'r'); if FID <= 0, error('Cannot open file'); end Data...

alrededor de 15 años hace | 0

Respondida
How to display values with formatting, converting numbers to strings.
Try this (as a cut/paste replacement of the code you posted): if size(cost,1) == 2 A = (4*Pdt*cost(1,3)*cost(2,3))...

alrededor de 15 años hace | 0

Respondida
Removal of duplicate entries and counting them
*If* you happen to have access to Statistics Toolbox, and you are actually messing with strings (like in your example), you migh...

alrededor de 15 años hace | 1

Respondida
How to display values with formatting, converting numbers to strings.
function multilinetext hf = figure; uicontrol(hf,'style','pushbutton','string','update',... 'position',[100,100,6...

alrededor de 15 años hace | 0

Respondida
Solving the scaling problem.
If it's just two vectors then you could do A = x2(1)/x1(1) norm(A*x1 - x2) A slightly more generalizable way is ...

alrededor de 15 años hace | 1

Respondida
[DISCONTINUED] Wish-list for MATLAB Answer sections.
Has anyone else been tripped up by the auto-folded comments? I'd personally prefer expanded by default, or at least a higher th...

alrededor de 15 años hace | 3

Cargar más