Answered
How to display answers using polyfit
How do you know the slop of the line before you do the fit? How noisy is the data? This seems to work: >> x = 0:1; y...

13 years ago | 0

Answered
How to do indexing without moving to a new variable ?
As far as memory goes, if you are o.k. in making the temporary variable through the other methods suggested here then you are o....

13 years ago | 3

Answered
How to fit legend inside a figure
Even with fontsize 1 the entries are not visible. I think you could make your own legend, but it would require a bit of HG fun ...

13 years ago | 0

Answered
An equivalent to jump/goto ?
There has been a feature request for quite some time to allow BREAK to have a level passed to it. Perhaps add your name to the ...

13 years ago | 1

Answered
y(t)=A1cos(200*pi*t)+A2sin(200*pi*t)
A1 = 3; A2 = 5; t = 0:1/(2*200*pi):pi/8; y = A1*cos(200*pi*t)+A2*sin(200*pi*t); plot(t,y) If you want to use an...

13 years ago | 0

Answered
systematic: Do not use global, don't use eval
EVAL is evil: Experience! Not just my own experience. Many times on CSSM and even here on answers a user asks, "How can I cre...

13 years ago | 8

| accepted

Answered
How to erase data from a matrix from the command line?
M=[3 1.2 13 2 1.2 0.3 0.3 10 10 2 1 0 0.7 5 3 0.4]; Nij = M(all(diff(sort(M,2),[],2),2),:)

13 years ago | 1

| accepted

Answered
if statement between cells arrays
This will fix your code: for i=1:length(p) if p{i}~=c{i} level1_root=p{i} break ...

13 years ago | 0

Answered
Search folders/paths with strfind: how to do excluding search?
You could just leave out the call to NOT in Index3.

13 years ago | 1

| accepted

Answered
How to create a matrix from given vectors
Here is the obligatory one liner. It works whether or not A has a zero. D = cumsum(ones(max(A),length(A))) <= A(ones(1,m...

13 years ago | 1

Answered
Creating a symbolic variable, then using it as a real variable
syms x y = input('Please enter a valid function of x: ') deriv = diff(y) % This will be symbolic x = 0:pi/30:pi;...

13 years ago | 0

| accepted

Answered
remove rows that contain zeros from cells array in matlab
m(cellfun(@(x) ~x(1),m(:,1)),:) = []

13 years ago | 2

| accepted

Answered
WHILE LOOP program does not work
You do not increment i or j inside the loops. i =i+1; etc. Thus i will always be less than m, and j less than n.

13 years ago | 0

Answered
How can I use randperm.m to convert one matrix to another?
% Say we are given this: A = randi(100,4,8); % Now the method: [m,n] = size(A); B = bsxfun(@(x,y) A(y,randperm(x...

13 years ago | 0

Answered
how to tabulate this results using fprintf?
Give some example values for your data... Here is a generic example on how to make nice tabulations: x = rand(5,1); ...

13 years ago | 0

| accepted

Answered
Why is this wrong??
I run your code and it plots 6 lines. check for yourself: >> length(findobj('type','line')) ans = 6 ...

13 years ago | 0

Answered
How to solve the following questions?
Your system is equivalent to: [2 3;2 3;2 3]*[x;y] = [-23;-19;-15] What makes you think this has a solution?

13 years ago | 0

Answered
extract seconds from timestamp in cell
Say your cell array looks like: T = {'2011-04-19T01:01:59.000Z';... '2011-05-19T01:21:02.000Z';... '2011-...

13 years ago | 1

Answered
fprintf %E Leading zero
Here is another: F = @(x)regexprep(sprintf('%13.6E\n',x*10),'(\d)(\.)(.*)','0$2$1$3')

13 years ago | 0

Answered
Cell contents assignment to a non-cell array object, hdf data
Just access each element of the cell array whenever you need to access one of the arrays, C{1} = magic(3); % Sample cell a...

13 years ago | 0

Answered
Does sin() have an error?
That _is_ the correct value for <http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F f...

13 years ago | 1

| accepted

Answered
Binary String to ASCII
How did you do it? This seems to work. M = 'Hello'; % Now encode: Mbinlong = reshape(dec2bin(double(M),7).',[],1) ...

13 years ago | 0

| accepted

Answered
how to concatenate different cells of a cell array in one cell without a loup ??
B = {{magic(2) magic(2)},{magic(2) magic(2) magic(2)}} B2 = cat(2,B{:})

13 years ago | 0

| accepted

Answered
trouble using "mean" function in MATLAB?
You are creating a vector with the elements of A, rather than indexing into A with a vector. Look at what happens: A = [...

13 years ago | 1

Answered
General questions about function and if command.
For the first question, it makes a difference how and where you are accessing the variables. Post a simple example for anlaysis...

13 years ago | 0

Answered
Help with looping problem
Why would you want to create 64 variables like that? What a mess it would be to deal with in further steps. Perhaps two cell a...

13 years ago | 0

| accepted

Answered
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Please do not use this awful construct to find the global minimum: MinInput = min(min(I)); % This is the cause of your pr...

13 years ago | 0

Answered
Create diagram where y axis has zero limits two times (-1 to 0,0 to 0,0 to 1)
This will get you started. I include most of the properties you will need to make it look right. You should look at the other ...

13 years ago | 0

| accepted

Answered
Why is my GUI Slider dissapearing when I set it's position?!
Actually it is there, at the default position. The usual way of initializing a uicontrol is to pass all properties at once: ...

13 years ago | 0

| accepted

Answered
Matrix must be square
Did you mean to take the element-by-element power of the arrays? Look at the difference: x = magic(2) % A 2-by-2 matri...

13 years ago | 0

| accepted

Load more