Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
polo Mahmoud
polo Mahmoud le 4 Nov 2019
Commenté : polo Mahmoud le 4 Nov 2019
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]

Réponses (1)

Guillaume
Guillaume le 4 Nov 2019
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.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by