need help creating a vector and and plotting
14 views (last 30 days)
Show older comments
Hello All,
Like many others, I am in need of assistance for a project I'm working on. I myself do not know what the issue is, my partner is also unsure, nor are my cohorts, and my professors chooses not to look at my code, which effectively neutralizes my immediate help. So anyway...
Some may notice, I have posted a similar thread on the newsgroup page. I apologize, I know this is not correct etiquette, however with deadlines so close, I don't have the luxury of waiting through the proper channels.
My assignment is to plot a contour of the salton sea and then plot salinity, elevation and exposed shore after x number of years.
So after finding the contour points, I made a single excel sheet to hold all the points. To provide an example, I had x y and z points. lets say x1, x2, x3, y1, y2, y3 and z1, z2, z3. Due to the irregular shape of the salton sea, all the values may be irregular themselves. x1 may have two points (1 and 5) x2, 3 (2, 4, 6,) and x3 5 points , (1, 0, 9, 2, 3) because they are tripled. y and z would have the same number of points of their respective triplets, i.e. x1, y1, z1 have two points, x3,y3,z3 have five.
When the excel spread sheet is read into matlab, each entry is read as a column vector.
then in my actual code, I use plot 3 to plot all the triplets eg. plot3 (x1, y1, z1) and then I hold on to plot the remaining points.
I then initialize approrpriate variables, and create empty vectors to store the data, of salinity, elevation etc...
I then use for loops to calculate the data and store them in the appropriate vectors.
I then want to create a figure to plot my other data since the map finished. the section of code is
createfigure(X1, Y1, Y2)
figure1 = figure('Name','Salinty & Elevation vs Time');
axes1 = axes('Parent',figure1,...
'YTickLabel',{'100','120','140','160','180','200'},...
'YTick',[100 120 140 160 180 200],...
hold(axes1,'all');
% Create plot
plot(X1,Y1);
During this part I get an error. Something that X1 Y1, and Y2 is undefined
I thought they were vectors were already defined since I created the empty vector and had imported column vectors data.
I'm sorry if this is vague. I want to post the full code; however, my prof is going to use a plagiarism check. I don't want to have a chat with my prof over possible plagiarism since its my own code.
For those who can help me and want to see my entire code, send me a message.
Of course, you should post a message in this thread too, so I can give you your earned best answer.
Cheers.
0 Comments
Answers (1)
Star Strider
on 7 Dec 2014
First, rest easy. There is no hierarchy with respect to the newsgroup (CS_SM) and MATLAB Answers. Some of us only surf one (I only surf Answers, for instance).
Second, the problem you are encountering is that MATLAB is case-sensitive, so x1~=X1, etc., and x1 and X1 are distinct variables.
4 Comments
Star Strider
on 8 Dec 2014
I don’t see where you read in your .xlsx file and assigned ‘x1’, ‘X1’ and the others. That seems to be where the problem is.
Please provide the lines where you read in your file and assign the variables.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!