I have figured out that Rolla is essentially a cell array and I decided to try plot(i, Rolla{:}); Unfortunately, now I get this error (Error using plot There is no 0.117325 property on the Line class.)
Error using plot Invalid second data argument
2 views (last 30 days)
Show older comments
Takhyung Seon
on 6 Dec 2017
Commented: Takhyung Seon
on 6 Dec 2017
Hi,
I am trying to plot a vector (size 690) and I am getting the error listed above (invalid second data argument).
I extracted data from a txt file using the function textscan. I have attached the code I am using below along with the matrix and vector, Aa Rolla. I am relatively new to MATLAB and I would appreciate the help.
%orientation data for sensor a
filename = 'exampleLogfile-000.txt';
fileIDa = fopen(filename);
Aa = textscan(fileIDa, '%s %s %s %s ', 'Headerline', 5);
Rolla = Aa{1,2};
Pitcha = Aa{1,3};
Yawa = Aa{1,4};
i = 1:690;
plot(i, Rolla);
Accepted Answer
Walter Roberson
on 6 Dec 2017
You are using %s formats to read your data. All of the entries are going to be character vectors. You cannot plot character vectors. Some of those %s need to be %f in the textscan()
More Answers (1)
Roger Stafford
on 6 Dec 2017
The variable 'Rolla' needs to be the same size as the 1:690 vector. You can check that by writing "size(Rolla)" in your script.
0 Comments
See Also
Categories
Find more on Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!