How Do I add user input to a matrix already defined in my work space?

조회 수: 2 (최근 30일)
Cody Abt
Cody Abt 2019년 9월 15일
답변: Prabhan Purwar 2019년 9월 19일
How do I add user input to a matrix already defined in my work space?
Matrix in work space is a 16x1 and Im trying to be able to add user input on whatever day they chose to the matrix to be able to update with new day they are asking for.

답변 (1개)

Prabhan Purwar
Prabhan Purwar 2019년 9월 19일
Following code illustrates the updation of data matrix based on user input
clc
close all
clear
%Defining a 16*1 random matrix
mat=rand(16,1);
%assuning 1 to 16 represents days
%User defined input
day=input('Enter day');
value=input('Enter value');
%Update value
mat(day)=value;
Please refer the following link for further information

카테고리

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