필터 지우기
필터 지우기

i want to make a user input file where the matrix would be loaded into matlab

조회 수: 2 (최근 30일)
polo Mahmoud
polo Mahmoud 2019년 11월 4일
댓글: polo Mahmoud 2019년 11월 4일
Hi i want a text file (txt-file) where the user eg. writes
txt file start:
A = 30;
IX = 10;
% A =
[ 1 2 3 IX
5 6 7 IX]
% B =
[ 1 2 3 A
5 6 7 A]
txt file end
and when you load this txt files in the matlab then i want the matlab to know what the matrix should look like:
% A =
[ 1 2 3 10
5 6 7 10]
% B =
[ 1 2 3 30
5 6 7 30]

답변 (1개)

Guillaume
Guillaume 2019년 11월 4일
Just make it a .m file (and remove the %).
Of course, don't use A both as the constant 30 and as the name of a matrix. You can use any name you want for your variables you don't have to limit yourself to the 26 letters of the alphabet, and you certainly don't have to reuse the same name for different purposes.

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by