How do i plot multiple array?

조회 수: 17 (최근 30일)
kyle duke
kyle duke 2018년 1월 22일
편집: Stephen23 2018년 1월 23일
clear; close all; clc; commandwindow;
load timeh
h=Height(1:5,1:6)
h1=Height(1,1:191)
h2=Height(2,1:191)
h3=Height(3,1:191)
h4=Height(4,1:191)
h5=Height(5,1:191)
t=0:.1:19
plot(t,h1)
Timeh is a file containing the information that needs plotted. Where am i going wrong?
  댓글 수: 2
kyle duke
kyle duke 2018년 1월 22일
no idea why it is bunched up
Stephen23
Stephen23 2018년 1월 23일
편집: Stephen23 2018년 1월 23일
Do not split up your data into lots of separate arrays. This is very rarely a good idea, as MATLAB handles complete arrays very simply for many operations and commands: see Walter Roberson's answer to see how one array can be plotted quite trivially.
Also creating lots of numbered arrays just makes accessing data more difficult, not easier!:

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 1월 22일
plot(t, h1, t, h2, t, h3, t, h4, t, h5)
Or more simply
plot(t, Height(1:5, 1:191).' )

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by