Index in position 2 exceeds array bounds (must not exceed 2)
Mostra commenti meno recenti
The assignment;;;
Section 3: Write a command to load data_set2.txt, and define time as column 1, and EMG data for muscle X as column 2, muscle Y as column 3 and muscle Z as column 4. Create the following variables:
o rate that defines the rate of capture (2000 Hz)
o timeinterval computed based on the rate of capture per second
o num as the length of samples collected
o totaltime as a function of num and timeinterval variables
o time starting at timeinterval and using timeinterval as the fixed interval between
samples to totaltime
Can someone help me out and indicate what I did was wrong...
7 Commenti
Guillaume
il 1 Mar 2020
Hard to tell without the full text of the error message or the input file. I suspect that your data_set2.txt file has only two columns (or at least only two columns have been imported into matlab) so of course, trying to access the 3rd column doesn't work.
Vanessa Arp
il 1 Mar 2020
Modificato: Vanessa Arp
il 1 Mar 2020
Image Analyst
il 1 Mar 2020
What does this show:
whos data_set2
Vanessa Arp
il 1 Mar 2020
Guillaume
il 1 Mar 2020
"the assignment said i need to create four columns so how do i do that if the file has only two columns"
As I said, "hard to say without seeing the input file". Since you can't magic data out of thin air, I'd say get a file with 4 columns.
Vanessa Arp
il 5 Mar 2020
Guillaume
il 6 Mar 2020
As the error tells you, you passed too many inputs to abs. abs only works with one input. I've no idea what the 2 in your call is meant to do.
Risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!