matlab - insert the content of a text file into a variable -
I want to fill ASCII characters in a text file and want to put all the content in MATLAB into a varialbe, this code I have tried:
f = fopen ('tp.txt') The result I get is 1, whenever whenever I type this code line To stimulate
However, when I try:
f = load ('tp.txt') I get this error Is:
??? ==> Load the number of columns on the line 1 of the ASCII file D: \ Cours \ TP \ tp.txt should be similar to the previous lines ==> Error in TPTI3F = Load ('TPTT') My goal is to rely on the opportunity of each playful, then calculate propellants and entropies.
Any thoughts?
Try this: As string str = importdata ('tp.txt'); % // Each line is a cell str = [str {:}]; % // Stop all lines in a line Remove %% Spaces You might also want to delete other characters: Punctuation ... str = regexprep (str, '\ s', ''); % / Calculation frequency of each character: freq = histc (double (str), 0: 255); % // Convert to alphabet ASCII code and count
Comments
Post a Comment