回答済み
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)

約15年 前 | 0

| 採用済み

回答済み
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...

約15年 前 | 0

回答済み
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...

約15年 前 | 1

| 採用済み

回答済み
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...

約15年 前 | 2

| 採用済み

回答済み
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...

約15年 前 | 0

回答済み
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 ...

約15年 前 | 0

| 採用済み

回答済み
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...

約15年 前 | 0

回答済み
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 ...

約15年 前 | 0

回答済み
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: ...

約15年 前 | 1

回答済み
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...

約15年 前 | 0

回答済み
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...

約15年 前 | 3

| 採用済み

回答済み
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)...

約15年 前 | 0

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

約15年 前 | 3

回答済み
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...

約15年 前 | 0

回答済み
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...

約15年 前 | 0

回答済み
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. ...

約15年 前 | 50

回答済み
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 ...

約15年 前 | 6

回答済み
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 +|...

約15年 前 | 0

| 採用済み

回答済み
[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...

約15年 前 | 7

回答済み
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://...

約15年 前 | 0

回答済み
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 ...

約15年 前 | 1

回答済み
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 = [...

約15年 前 | 4

| 採用済み

回答済み
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...

約15年 前 | 0

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

約15年 前 | 0

回答済み
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))...

約15年 前 | 0

回答済み
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...

約15年 前 | 1

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

約15年 前 | 0

回答済み
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 ...

約15年 前 | 1

回答済み
[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...

約15年 前 | 3

回答済み
How to display values with formatting, converting numbers to strings.
If I interpret your question correctly, you're asking how to get the nicely formatted output in the text box. If that's the cas...

約15年 前 | 0

さらに読み込む