Answered
datestr datenum problem with year conversion.
Time series objects seemingly use the differential time internally; use the _getabstime_ method to return the actual time vector...

12 years ago | 0

Answered
Trying to plot a piecewise function in different colors
Looks like the basic idea should work...don't say precisely what your problem is, specifically, but consider the trivial example...

12 years ago | 2

Answered
Reading a .txt file
Of course *fscanf* can read it if you work on the formatting sufficiently. With an irregular file structure, though, it'll be p...

12 years ago | 1

| accepted

Answered
Finding elements in column that meet some criteria
M=sortrows([m(:,2:3) m(:,1)],[1 2]); Presuming _m_ is original array w/o the header line and your "Z" is really "Y" Or, ...

12 years ago | 2

| accepted

Answered
How do I call a function after I ask for the input?
The trailing semicolon on the line calling your function caused Matlab to not echo the result to the command line... Fibona...

12 years ago | 1

Answered
Why random number blocks have the same randomness?
From the doc I find the following interesting note-- _"To use other algorithms supported by MATLAB in a Simulink model, gener...

12 years ago | 1

| accepted

Answered
Not enough input arguments M-file piecewise function
The function prototype is function v=vpiece(t) requiring an argument yet you call it as >> vpiece with no argum...

12 years ago | 1

Answered
Hi guys, i want to ask something since im still new using matlab..how can i iterate loop from negative variable to its positive variable?..and do you guys know anything about appearing a GIS/google earth into GUI?
_... how can i iterate loop from negative variable to its positive variable?_ Many alternatives... Generate an array of va...

12 years ago | 0

| accepted

Answered
Attempted to access A(0,0); index must be a positive integer or logical.
Ayup... for i=1:33 for j=1:75 volA(i,j)=((A(i-1,j-1)+A(i,j-1)+A(i-1,j)+A(i,j))/4)*2500; when, _i_,_j_==1, ...

12 years ago | 2

Answered
Help understanding matlab code ?
for i=2:R for R=1 is an empty loop Matlab for loop control is for start:[increment:]end with the default for _i...

12 years ago | 1

Answered
Getting parameters of statistic using probplot()
*probplot* only does the visualization; for some reason TMW didn't deign to return the parameters for the data fit--seems like a...

12 years ago | 1

| accepted

Answered
separating non empty array
a=[b c]; The ';' caused vertical concatenation; a ',' or space is horizontal. Read the "Getting Started" section on basic ...

12 years ago | 1

Answered
Why does import data hang up on 70 Mb file?
Are the values consistently space-delimited, not fixed width fields I gather from the description? If there aren't missing valu...

12 years ago | 1

Answered
Is it possible to combine "for" and "if" like this?
Yes... :) (the answer to the question asked). You can see this as you run the code as given above since the value of w=0 is pr...

12 years ago | 1

Answered
What is the "models" and "blocks"?
That portion is applicable to Simulink only, _NOT_ Matlab (they're two separate products). Simulink is a modeling system cons...

12 years ago | 1

| accepted

Answered
wrong figure is saved with gcf command
*gcf*, as the name implies, returns the handle of the _current_ figure. The current figure is the one that has focus at the tim...

12 years ago | 2

Answered
How to make a copy of a built-in function and get it to work?
First, read <http://www.mathworks.com/help/matlab/matlab_prog/private-functions.html> on private functions and resolvin...

12 years ago | 1

Answered
Optimizing nested for loop
If that's the significant fraction, you can try param=sprintf('params%d',length(bin(bin < inpdata))); instead.

12 years ago | 1

| accepted

Answered
how to calculate the elapsed time between rows
Can't just subtract times in hr,min,sec form since there's rollover. Convert to datenums and subtract them then convert back to...

12 years ago | 2

Answered
Error "Subscript indices must either be real positive integers or logicals."
I don't know precisely what you're after, of course, but after breaking the line up I just created some dummy values and started...

12 years ago | 2

Answered
How to plot different functions of different colors in the same figure in a FOR cycle
Almost there... ch = {'k--' 'ro-' 'bs-' 'g^-'}; for i=1:4 plot(rand(10,1),ch{i}) if i==1, hold on, end end ...

12 years ago | 2

| accepted

Answered
xcorr and time lag
t=-length(x)+dt*idx; where _dt_ is the sampling time interval. BTW, this is for full-length. If use the optional MAXLAG...

12 years ago | 1

| accepted

Answered
Matlab complier for speed
"All depends..." :) On what you're compiling and how you're comparing to specific Matlab code. At its heart for matrix oper...

12 years ago | 1

Answered
why do I get the error : Index exceeds matrix dimensions?
It took a while to puzzle thru what you're doing...I still have absolutely no klew as to _why_ one would do this, but... The ...

12 years ago | 1

| accepted

Answered
Data on Y-axis, Date & time on X-axis
As noted above, took your data and pasted it into Excel... >> [data,dates]=xlsread('krunal.xls'); >> dn=datenum(dates(2:en...

12 years ago | 0

Answered
Data on Y-axis, Date & time on X-axis
As was said multiple times in the previous thread, use [nums,dates] = xlsread (orginf,sheet,'C2:S151'); instead of the r...

12 years ago | 0

Answered
How to eliminate values in a matrix so i have a high Rsquare linear regression
If it's known the data are linear with an outlier or two, possibly the most sensitive test would be something based on the gradi...

12 years ago | 2

Answered
How to copy the elements from the .dat file (contains 441 rows and 2 coloumns) into an array using for loop?
doc importdata % and friends No loop needed.

12 years ago | 1

| accepted

Answered
Total data in the group
>> d=[7 3 11 11 10 10]; >> u=unique(d); >> [u;histc(d,u)] ans = 3 7 10 11 1 1 2 2 >>

12 years ago | 1

| accepted

Load more