Simple question about scatter/data plots

조회 수: 14 (최근 30일)
Mikey Pham
Mikey Pham 2018년 12월 6일
답변: TADA 2018년 12월 6일
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?

채택된 답변

TADA
TADA 2018년 12월 6일
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개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by