string - reading character arrays from a file to another array in matlab -


I have a text file that contains different combinations of characters. For example:

  a + b * cb + c * ac + a * b   

I want to read this file in matlab, and want to assign each row to an array like this :

  c (1) = a + b * cc (2) = b + c * ac (3) = c + a * b   

Next, I would like to assign other character arrays to A, B, C etc. For example, I print

  a = 'A', B = 'B', C = 'C'   

and final output like this Do:

  c (3) = C + A * b   

But I'm stuck in both phases, how different character arrays in matlab According to the way to read and allocate different lines. Any suggestion would be appreciated.

Read the text in one cell array and replace it one by one.

Code

  %% // The name of your text file is file1 = 'eqns.txt' c = importdata (file1) c = strrep (C, 'one', 'a'); C = Strope (C, 'B', 'B'); C = strrep (c, 'c', 'c')   

output

  c = 'a + b * C '' b + c * a '' c + a * b 'c =' a + b * c '' b + c * a 'c + a * b'   

If you are interested in getting the alphabet in the upper case, you can do this directly after importing the data -

  c = importdata (file1) c = upper (c)    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -