Why am I getting "Invalid first data argument"

I am trying to plot the following.
s = {Fun_WS1; Fun_WS2; Fun_WS3; Fun_WS4; Fun_WS5; Fun_WS6; Fun_WS7; Fun_WS8; Fun_WS9; Fun_WS10};
h=[0:10];
semilogy(s,h);
I have all the Fun_WS values defined in the workspace (shown in the attached .PNG).
Why am I getting "Invalid first data argument"?

 Accepted Answer

Try this:
s = [Fun_WS1; Fun_WS2; Fun_WS3; Fun_WS4; Fun_WS5; Fun_WS6; Fun_WS7; Fun_WS8; Fun_WS9; Fun_WS10];
h=[1:10];
semilogy(s,h)
Using a cell array here is inappropriate. Use a regular vector instead. Also, ‘s’ has 10 elements, ‘h’ originally had 11. I corrected that.
NOTE Since I do not have your original data, only the image, this is UNTESTED CODE. It should work.

More Answers (0)

Categories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!