Simple question about scatter/data plots
15 views (last 30 days)
Show older comments
Say I have two scripts. The first one is called RideData. It contains four arrays that are called speed, distance, climb, and calories. Those are the four variables assigned to four arrays. The second script is the main one where I want to create a scatter/data plot. If I wanted to use the speed and distance arrays from the first script to plot in the second script, how would I call the first script in order to plot using those arrays?
0 Comments
Accepted Answer
TADA
on 6 Dec 2018
Your best option is to change your RideData script into a function (see documentation about functions) and have that function return those arrays, something like that:
function [speed, distance, climb, calories] = RideData()
% enter your functionality here
end
then you simply call the function from your main script like that:
[speed, distance, climb, calories] = RideData();
% now you can plot your stuff
0 Comments
More Answers (0)
See Also
Categories
Find more on Scatter Plots 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!