Answered
How to make this long if-else chain compact?
Several alternatives -- probably bestest is table lookup state=floor(interp1(cdist,[1:nStates],p)); Can get there also w...

12 years ago | 1

Answered
How do I remove element lower/greater than a certain value in a matrix?
Use my helper function *iswithin* >> A(iswithin(A,5,11)) ans = 7 10 9 8 >> >> type iswithin f...

12 years ago | 2

Answered
Problem with dates and intersect
dat_2011=(datenum(2011,01,01,0,0,0):1/24:datenum(2011,12,31,23,0,0))'; _... Did I maybe do something wrong when I created t...

12 years ago | 0

| accepted

Answered
how can i write this matrix in matlab?
Given input _n_ and r = [1 4 1]; c={repmat(r,n,1)}; % cell array of n copies of r m=blkdiag(...

12 years ago | 0

Answered
write equation automatically and create a file which save the constant term of the equation
_...I want the equation to appear automatically on the graph and not I place each one._ Use *text* instead of *gtext* You'll...

12 years ago | 0

| accepted

Question


Grouping legend entries and adding group identification
OK, I've struggled with the *legend* doc and the discussion on graphic object groups and the examples therein but doesn't fit th...

12 years ago | 1 answer | 0

1

answer

Answered
Read same cell in multiple excel files
I'd hope all the files to be read are in the same location and have at least some naming convention in common. If so, the simpl...

12 years ago | 0

Answered
Creating a matrix with repeating the same numbers.
Not a lot of work there... v=repmat([2:t],2,1); A=[1 v(:).' t+1];

12 years ago | 1

| accepted

Answered
How do I calculate differences in one column for specific pairs of rows (whose index are listed in another matrix)?
"Deadahead" solution... for i=1:size(A,1) D(i)=B(A(i,2),11)-B(A(i,1),11); end

12 years ago | 0

| accepted

Answered
Inner matrix dimensions must agree.
P=P+(P(1:n,3)*(P(1:n,1)*... '*' is matrix multiply in Matlab and P(1:n,N) is a column vector of size nx1. To multiply two...

12 years ago | 0

Answered
How to enter input variable from dialog box into text file?
_fprintf(fileID,['His name is %s.', name]);_ should be fprintf(fileID,'His name is %s.', name); You've put the variab...

12 years ago | 0

| accepted

Answered
Selecting very specific data from a table using a for loop
Sure...as said, if you do the *reshape* to columns, you'll end up with a column of _T, X_, and _Y_ for each machine/motor. That...

12 years ago | 2

Answered
Selecting very specific data from a table using a for loop
_"I want to put each set of 0.25:0.25:154.5 into separate tables with the associated 'title' and 'y'."_ I'd ask "why"? It's ...

12 years ago | 2

| accepted

Answered
How to convert number to string vector
Trivial... >> [a,b,c] ans = 2014 10 25 2014 11 24 >> datestr(datenu...

12 years ago | 2

Answered
How can I create a 10x4 matrix with a for loop?
1) It _doesn't_ refer to _A_, it refers to the rows in _B_. (It must, because it's part of a subscripting expression for _B_)....

12 years ago | 0

| accepted

Answered
how to swap rows between matrix?
Presuming you mean literally the simple-minded swap row-by-row depending on the D between the two, it's pretty simple. Given ...

12 years ago | 3

| accepted

Answered
How to delete specific lines from a txt file?
Given your _E_ and _G_ arrays, [~,idxE,idxG]=intersect(E(:,1),G(:,1)); write new files E(idxE,:) and G(idxG,:) ...

12 years ago | 1

Answered
How can I get averaged value from multiple lines of txt file.
d=dir('hel1*.txt'); % list of files res=zeros(length(d),3); % room for the results for i=1:length(d) x=...

12 years ago | 1

| accepted

Answered
Comparing a logical matrix and a numerical matrix?
masked=orig; % all; only the false entries need modification masked(~mask)=orig(~mask)/4; % so fixup those....

12 years ago | 1

Answered
FInding value that satisfies 2 conditions
Assuming I do understand what you're looking for, look at the following-- I took your above vector and augmented it just a li...

12 years ago | 1

Question


Word Matlab Notebook and figures...
Have a script generating several figures -- may be 10 or more eventually. Need to use these in a Word document for distributi...

12 years ago | 1 answer | 0

1

answer

Answered
csvread without decimal point
But it _is_ the input data...you're ignoring the scale factor Matlab uses when display disparate values on the command window......

12 years ago | 0

| accepted

Answered
Scaling arrys to each other
doc interp1 or if have Signal Processing Toolbox doc resample Or, if possible, collect a time stamp with the data i...

12 years ago | 1

Answered
FInding value that satisfies 2 conditions
idx= (find(diff(RuleState)==1)) | (find(diff(RuleSTate)==6)); You're *or*'ing the result of *find* which is the numeric loc...

12 years ago | 1

Answered
Index exceeds matrix dimensions.
You've got a bunch of different variable names -- I'm guessing there's the problem. The error line has two-- Error in Un...

12 years ago | 0

Answered
how can I plot a vector 'g+' under a f(x) and 'r+' over f(x)
y=f(x); plot(x,y) hold on ix=v>y; % vector>f(x) logical array plot(x( ix),v( ix),'color','r') plot(x(~ix),v(~...

12 years ago | 1

Answered
Constructing the serial date vector
Ignoring whether there's a leapyear in the two, dn=datenum(y0,m0,d0,0,[0:2*365*24*60].',0); Add one more day to the day ...

12 years ago | 0

| accepted

Answered
Making Matlab throw an error on index out of bounds
AFAIK, automagic reallocation is built in so deeply there's no way to avoid it. Best you can do is sotoo assert(j>length(i...

12 years ago | 2

Load more