Beantwortet
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 ...

mehr als 15 Jahre vor | 1

Beantwortet
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)

mehr als 15 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 15 Jahre vor | 0

Beantwortet
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...

mehr als 15 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 15 Jahre vor | 2

| akzeptiert

Beantwortet
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...

mehr als 15 Jahre vor | 0

Beantwortet
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 ...

mehr als 15 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 15 Jahre vor | 0

Beantwortet
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 ...

mehr als 15 Jahre vor | 0

Beantwortet
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: ...

mehr als 15 Jahre vor | 1

Beantwortet
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...

mehr als 15 Jahre vor | 0

Beantwortet
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...

mehr als 15 Jahre vor | 3

| akzeptiert

Beantwortet
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)...

mehr als 15 Jahre vor | 0

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

mehr als 15 Jahre vor | 3

Beantwortet
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...

mehr als 15 Jahre vor | 0

Beantwortet
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...

mehr als 15 Jahre vor | 0

Beantwortet
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. ...

mehr als 15 Jahre vor | 50

Beantwortet
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 ...

mehr als 15 Jahre vor | 6

Beantwortet
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 +|...

mehr als 15 Jahre vor | 0

| akzeptiert

Beantwortet
[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...

mehr als 15 Jahre vor | 7

Beantwortet
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://...

mehr als 15 Jahre vor | 0

Beantwortet
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 ...

mehr als 15 Jahre vor | 1

Beantwortet
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 = [...

mehr als 15 Jahre vor | 4

| akzeptiert

Beantwortet
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...

mehr als 15 Jahre vor | 0

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

mehr als 15 Jahre vor | 0

Beantwortet
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))...

mehr als 15 Jahre vor | 0

Beantwortet
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...

mehr als 15 Jahre vor | 1

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

mehr als 15 Jahre vor | 0

Beantwortet
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 ...

mehr als 15 Jahre vor | 1

Beantwortet
[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...

mehr als 15 Jahre vor | 3

Mehr laden