{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

30 - CS1371Recitation Miniquiz fh=fopen'encyclopedia'r...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 1371 Recitation 9/30/08 Mini-quiz: fh = fopen('encyclopedia.txt', 'r'); count = 0 txt = fgetl(fh); while ischar(txt) count = count + 1 txt = fgetl(fh); end fclose(fh) ----------------------------------- load/save x.mat load x save y ----------------------------------- xlsread xlswrite dbl cell cell [num, txt, raw] = xlsread(filename) Nan = not a number raw = everything so dimensions are correct txt = strings in xls and empty strings ' ' if number or not string str(char) xlswrite(filename, cA) -------------------------------------- function xlsParse(filename) [num, txt, raw] = xlsread(filename); for i = 1:numel(raw) if raw{ i } == 9 raw{ i } = 'silly'; end end
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
xlswrite(['new', filename], raw) ---------------------------------- (str) csvread(filename) dlmread(filename, dlm) num = csvread('y.csv'); num = [1 2 3 4 5 6] dlmread('y.csv', ' , ') ----- delimits by things separated by a comma (tab = ' \ t ') dlmwrite csvwrite str numerical array csvwrite(filename, numarr) dlmwrite(filename, numarr, dlm) ------------------------------------ fh = fopen(filename) fgets ---- returns \n x = fgets(fh) x(end) = newline fgetl --- \n ---- dlm fclose(fh)
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern