Answered
Separate string and perform math operations in Matlab
Something's going in what what _isn't_ shown; namely the actual code inline with the results instead of piecemeal describing wha...

10 years ago | 1

| accepted

Answered
Extract several rows from Matrix, Manipulate them in a Function and Re-Insert them at same position in Matrix
Address the target the same way as the selection... ix=(SubSets==1); % LOGICAL would be superfluous here, used a shorter i...

10 years ago | 1

| accepted

Answered
How can I plus (append) string in each loop?
I presume _output_ is a typo intending _person_. But you don't need a loop nor any logical tests at all... >> people=['A':...

10 years ago | 1

Answered
How to get a single beta in a univariate regstats regression
Save the coefficients from the structure to an array via comma-list via brackets notation and retrieve from there-- beta=[s...

10 years ago | 0

Answered
[DISCONTINUED] MATLAB Answers Wish-list #4 (and bug reports)
As of last day (or perhaps two?) every reply Answer/Comment elicits the "Leave Page?" popup even when have SUBMITted the respons...

10 years ago | 0

Answered
Formula for cross-correlation in matlab
In the Statistics Toolbox, see doc corr

10 years ago | 0

Answered
For-loop refuses to save five values in 1 vector, instead saves one value in 5 vector. How do I fix this?
Use vector solution...one of many ways x=abs(x); mextreme=x([false and(diff(x(1:end-1))>0,diff(x(2:end))<0)]); Exampl...

10 years ago | 0

| accepted

Answered
Read in a .txt format with textread
Besides the comment noted above by Star, your format string doesn't match the record -- the date/time fields aren't valid _'%f'_...

10 years ago | 0

Answered
How to find the max deflection in the beam and position of the max deflection ?
You've run the loop to compute _y_ but didn't save anything excepting the last value since didn't use an array but just a single...

10 years ago | 1

Answered
what does 1x8 struct mean?
It's an array of structures oriented as a row vector of those structures, each entry of which has three fields. Simple example ...

10 years ago | 0

Answered
How to remove rows in a table
Ensure the data are sorted in ascending date/time then use *unique*. The default for the optional named parameter _'occurrence'...

10 years ago | 0

Answered
Index out of bounds error
H1(1) = H0; for i = 1:(N-1); ... Pm1(i) = eta * rho * g * (Hm(i)-H1(i)) * Qm1(i); ... end %Available H...

10 years ago | 0

| accepted

Answered
¿How can I get the value of a variable that is inside a function?
Since you have to write the specific variable anyway, I'd just add the name--something like ... A=random(5); >> A=randn...

10 years ago | 0

| accepted

Answered
Matrix Indexing from an Array of Numbers
One soluion; may be some "more better"... idx=cell2mat(arrayfun(@colon,Z,Z+4,'uniform',0))); % column indices vector A=...

10 years ago | 1

Answered
Function Sort to find smallest value in a Column?
Don't have Toolbox here so can't try it, but looks like you'll want the *sortfts* function to deal with a _FTSOBJ_ See <http:...

10 years ago | 0

Answered
Regarding a plotyy generated plot: using the edit plot feature, can I make changes such as font size on the right hand side vertical axis?
W/O anything else, doesn't appear you can. If you save the axes handles when create the figure with *plotyy* and then set the R...

10 years ago | 0

Answered
How do I plot real and imaginary parts on one graph(figure)? And how do I do that separately?
No need for symbolics here...I'd use function handles instead-- xred=@(x) 6*pi*10.^8./x; % make a simplification by defini...

10 years ago | 0

| accepted

Answered
Plotting time vector in seconds on x-axis in HMS
Prior to R2015, use *datenum* and convert to datenumbers and plot against them and then *datetick* to display the axis with time...

10 years ago | 0

Answered
Problems with for-loop.
The loop above in Matlab parlance is simply z(1:length(tfail_or_ges))=(t==tfail_or_ges_sort); where _z_ will be the logi...

10 years ago | 0

Answered
How to reformat a matrix with a continuous string
>> B=[cellstr(num2str(A(:,1))) cellstr(char(A(:,2:end)+'A'-20))] B = '7843' 'ABCEB' '2345' 'BDCEF' '545...

10 years ago | 0

| accepted

Answered
how to fill the value of "1" where ever you want in an array.
_"repetition of 1's sequence in the positions 1,17,33,49..." Use colon indexing-- t(1:16:LENGTH)=1; where _LENGTH_ is...

10 years ago | 0

Answered
How to use xlswrite to wirte excel sheet each time dynamically?
You have to decide where in the sheet you want the values written; *xlswrite* will not accept multiple ranges in a single call; ...

10 years ago | 0

Answered
How to get rid of the baselines while using "waterfall" command?
This may not be the best solution but I don't have time to delve into the guts of *waterfall* and/or *mesh* to figure out precis...

10 years ago | 0

| accepted

Answered
4 curve in one graph
File Exchange is your friend... <http://www.mathworks.com/matlabcentral/fileexchange/4425-ploty4-m <PlotY4>> or <http://www.math...

10 years ago | 1

| accepted

Answered
how can I sort an array of elements corresponding to another array of elements in decreasing order?
[A,idx]=sort(A,'descend'); B=B(idx); doc sort % for details

10 years ago | 3

Answered
How to select the row of an element in a vector and put it in the same row for a different matrix?
Well, much is undefined but the indexing is pretty simple... B(A==1,icol)=sum(A); Now, you'll have to iterate or otherwi...

10 years ago | 0

Answered
repeating the same statement using loop
Refactor out the commonality into a subroutine where can use the same variable names without clashing with scope -- obj = 1...

10 years ago | 0

| accepted

Answered
how to append data from mat file.?
I expect you'll just make your loading time worse but I'd use the *matfile* object to try this and see how it goes... Start b...

10 years ago | 0

Answered
I need most efficient code for these commands
Well, as Walter says but replacing _"most"_ with _"more"_, with Matlab replacing all the exponentiations with their numeric equi...

10 years ago | 0

| accepted

Answered
Referencing another row value if a number in the same row is false.
>> c={ 'Bob' 'Josh' , 0; 'John' 'Garrett', 1}; >> c(cellfun(@(x) x==0,c(:,3)),1:2) ans = 'Bo...

10 years ago | 0

Load more