필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

vectors must be the same length error

조회 수: 1 (최근 30일)
Yashashwani xxx
Yashashwani xxx 2017년 11월 23일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi all,I am new to matlab. I am trying to implement an intersecting roads but getting this error "vectors must be the same length". Could someone help me in this code? Thanks in advance...
clc
clear all
rw=10;
roadcenters1=[0 25;50 25];
roadcenters2=[0 -25;0 25];
width=10;
plot(width,roadcenters1,roadcenters2);

답변 (1개)

Rik
Rik 2017년 11월 23일
Read the documentation (just type doc plot). You will learn that this is not the syntax you're looking for. If you want a plotted line to have a certain width, use the 'LineWidth' property.
  댓글 수: 2
Yashashwani xxx
Yashashwani xxx 2017년 11월 23일
If I do not write width in plot(width,roadcenters1,roadcenters2) it simply plot two intersecting lines. Could you provide me the code to draw two intersecting roads?
Rik
Rik 2017년 11월 23일
You can use plot to plot lines of a few different kinds, but they stay lines. If you want to plot two pairs of thick lines, use the code below.
roadcenters1=[0 25;50 25];
roadcenters2=[0 -25;0 25];
width=10;
plot(roadcenters1,'b','LineWidth',width)
hold on
plot(roadcenters2,'r','LineWidth',width)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by