필터 지우기
필터 지우기

Info

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

A question about generating a matrix

조회 수: 1 (최근 30일)
Yuxing Zhang
Yuxing Zhang 2018년 10월 11일
마감: MATLAB Answer Bot 2021년 8월 20일
If I want to have a matirx which follows the change of n, says when n=2, A=[0 1] when n=3,A=[0 0 1], n=5, A=[0 0 0 0 1]. How can I achieve this goal using code? Thank you.

답변 (1개)

Bruno Luong
Bruno Luong 2018년 10월 11일
clear A
A(n) = 1
  댓글 수: 2
Yuxing Zhang
Yuxing Zhang 2018년 10월 11일
Thank you very much, can I ask for what if I want to generate A=[o;o;1]?
Bruno Luong
Bruno Luong 2018년 10월 11일
편집: Bruno Luong 2018년 10월 11일
Presumably you want "0" and not "o", add the following
A=A(:)
or
clear A
A(n,1) = 1

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by