From: Kay on
I need to create a piece of code in Matlab that will take input a
text file with some values such as 2/2, 1/2, 1/1, and 0/0 and
converts all the 2/2 to 2, 1/2 to 1, 1/1 to 0 and 0/0 to -1 and
outputs this data to another text file.

Can somebody please help me out?

Karim
From: Joseph on
a = '1/2';
b = find(a=='/');

num(:,1) = str2num(a(1:b-1));
num(:,2) = str2num(a(b+1:end));

This code will allow for multiple-digit returns

everything else can be solved with save or fwrite

cheers

Kay wrote:
>
>
> I need to create a piece of code in Matlab that will take input a
> text file with some values such as 2/2, 1/2, 1/1, and 0/0 and
> converts all the 2/2 to 2, 1/2 to 1, 1/1 to 0 and 0/0 to -1 and
> outputs this data to another text file.
>
> Can somebody please help me out?
>
> Karim