Answered
Using a loop to create multiple variables
_...to create multiple arrays (X and Y values) so I can analyse each cycle later on_ Then I'd suggest to rearrange to do the ...

12 years ago | 1

Answered
comparing and addition of two matrices
Look up "logical addressing"... >> ix=[b<a(:,1) a(:,2:end)>0]; >> a(ix)=a(ix)+5 a = 9 46 53 0 0 0...

12 years ago | 1

| accepted

Answered
offset between 2 axes when using plotyy
Never seen that symptom before; then again I don't use the plot tools menu much. It looks like somehow dragged the RH axes lo...

12 years ago | 3

| accepted

Answered
read specific files in a directory
<http://www.mathworks.com/matlabcentral/answers/132312-how-to-import-all-files-with-the-same-extension-from-specific-folder-to-m...

12 years ago | 2

Answered
How to group the corresponding elements of an array?
If you have a recent release, put the coefficient data into a *table* object... <http://www.mathworks.com/help/matlab/matlab_...

12 years ago | 2

Answered
read specific lines from text file
Start w/ the simplest and work up from there...try just data=importdata('yourfile.ext'); and likely bliss will follow au...

12 years ago | 1

Answered
How to choose a random value from an array?
Then you must want to only generate a single index instead of two and use it for both-- idx=randperm(length(A_index),1); ...

12 years ago | 4

| accepted

Answered
How can I get my x-and y-values of my polynomial fit into a matrix?
_...how I can get those x- and y-values from that fit-curve into a matrix 1020 rows 2 columns_ You've already got _x_ and _y_...

12 years ago | 1

Answered
Conversion from daily to monthly frequency
First idea -- create the datenum() vector of the time series and then the EOM (end-of-month) days for the year(s) included withi...

12 years ago | 2

Answered
How can I get my x-and y-values of my polynomial fit into a matrix?
The bigger problem is the choice of a fitting polynomial of order 9 is giving (mostly) nonsense. Just as an example, look at ...

12 years ago | 1

Answered
some questions about how to read and write txt file on matlab
1) When you switch to mixed character/numeric data, then *csvread* and friends are no longer suitable to use--they can't (and a...

12 years ago | 1

| accepted

Answered
Variable file name in print function using object handle
The problem is you wrote the whole name as a literal string instead of using the variable-- print(h, '-dbitmap' , fullfil...

12 years ago | 1

Answered
Matlab not giving several matrices against a for loop
The _e_ array is simply e=pi/2*eye(Nt); The *else* clause can never execute as there's nothing other than _j==k_ or _j~=...

12 years ago | 1

Answered
Data is in MESHGRID format, NDGRID format is required. INTERP2 help please!
_...any ideas how I should rearrange the data?_ I don't quite follow _your_ words :) on the ordering but what you need is lik...

12 years ago | 0

| accepted

Answered
Data is in MESHGRID format, NDGRID format is required. INTERP2 help please!
... m50m(:,:,day)=interp2(lonrep,latrep,squeeze(mask(:,:,day)),REF_lon,REF_lat,'linear'); You don't show how _lonrep/lat...

12 years ago | 1

Answered
Increasing vertical spacing between subplots
Shrink the height of the axes POSITION property and, if so desire, then readjust the bottom location to be equidistant if more t...

12 years ago | 0

Answered
How to count number of Elements in a coloumn matrix of 10 entries.
IIUC, that would simply be sum(a==1)/length(a); I'm presuming you meant semicolons in place of the colons in your sample...

12 years ago | 1

| accepted

Answered
Curve fitting with more than 3 variables
Don't know about web sites; the Matlab doc starts under doc Open the Statistics Toolbox section, select "Regression and ...

12 years ago | 2

Answered
how to change a line in text file?
<http://www.mathworks.com/matlabcentral/answers/132079-replacing-a-string-with-another-string-in-a-text-file>

12 years ago | 1

| accepted

Answered
Textscan problem, empty values and NaN
Fixing the format statement should do it... >> t=char(9); % tab char to build a sample string >> l=['2014/02/20' t '12:0...

12 years ago | 0

Answered
Find a match in a structure array using arrayfun
Not certain; it did for a small sample case here...but you can write it w/o *arrayfun* as ix=find([s.Month]==m & [s.Day]==d...

12 years ago | 1

| accepted

Answered
I want to read the header data. The data file is attached. In the fffffff row there are two data values that I need to read and also in the qqqqqq column there is only one data. How can i read this?
_... qqqqqqqq which has a numeric data (83.58) after |. I have almost 10000 files ..._ Presuming there's a consistent naming ...

12 years ago | 1

| accepted

Answered
I want to read the header data. The data file is attached. In the fffffff row there are two data values that I need to read and also in the qqqqqq column there is only one data. How can i read this?
fid=fopen('yourfile','r'); fgetl(fid) l=fgetl(fid); datedata=sscanf(l(strfind(l,'|')+1:end),'%4d-2d-2d %2d:%2d:%2d+%2...

12 years ago | 1

Answered
How do I use a loop to isolate column vectors of a matrix into separate variables
The answer is "Don't do that!!!" See the FAQ for why it's _a_bad_idea_ (tm) and alternatives... <http://matlab.wikia.com/w...

12 years ago | 2

| accepted

Answered
Curve fitting with more than 3 variables
That's correct; the *cftool* GUI is limited to curves or surfaces. You can define other more general models you wish with wit...

12 years ago | 2

| accepted

Answered
Replacing a string with another string in a text file
_... I also know that the "y=" line occurs exactly 4 lines after the "unique string"_ while ~feof(fi) l=fgetl(fi); ...

12 years ago | 2

Answered
Why do I get an erro when using the built-in function gradient() ?
Because you call F w/o any argument list. Try x=1:3; gradient(F(x)) instead. However, I suspect this isn't doing ...

12 years ago | 0

| accepted

Answered
Using while ~feof(fid) - Subscripted assignment dimension mismatch.
_...The lines of the blocks of data are not constant, some blocks have 7 lines, some have 8, 9 and so on_ The first number in...

12 years ago | 3

| accepted

Load more