Calculating using individual array entries
Calculating using individual array entries
(OP)
Hi,
Im a beginner at matlab so please bear with me. I want to create a function that has 2 inputs from a datafile. Both are individual columns of a three column data file with input 1 as column 1 and input 2 as column 2. Is there a way I can make a formula to find the differences between consecutive entries in column 1? For instance, column 1 is:
5
8
2
7, therefore the output would be 3,-6,5. Any ideas? Thanks for any help.
Im a beginner at matlab so please bear with me. I want to create a function that has 2 inputs from a datafile. Both are individual columns of a three column data file with input 1 as column 1 and input 2 as column 2. Is there a way I can make a formula to find the differences between consecutive entries in column 1? For instance, column 1 is:
5
8
2
7, therefore the output would be 3,-6,5. Any ideas? Thanks for any help.





RE: Calculating using individual array entries
TTFN
RE: Calculating using individual array entries
Boy you really are new to Matlab! Operations on columns of data are the bread and butter of Matlab analyses:
>> x=[5 8 2 7]'
x =
5
8
2
7
>> diff(x)
ans =
3
-6
5
RE: Calculating using individual array entries
RE: Calculating using individual array entries
You'll probably find questions like your previous one being directed at The Mathworks' getting started pages. But hey, they're pretty good...
I post there quite a lot too. See if you can recocognise me.