Filter löschen
Filter löschen

how to read a txt file as input values?

4 Ansichten (letzte 30 Tage)
sam plant
sam plant am 8 Nov. 2018
Kommentiert: sam plant am 9 Nov. 2018
I wish to read a txt file with a 4x4 square of input values st matlab reads the first row and enters them into my inputs, then the second row etc... any help would be appreciated!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Nov. 2018
num = load('YourFile.txt') ;
for K = 1 : size(num, 1)
First = num(K, 1);
Second = num(K, 2);
Third = num(K, 3);
Last = num(K, 4);
Do whatever at this point
end

Weitere Antworten (0)

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by