Write a function named ''read_line''

Assignment Help MATLAB Programming
Reference no: EM13163481

  1. a) Write a function named 'read_line' which has one input

    parameter ('specs') and one output parameter ('ret_line'). Your

    function should do the following:

  2. b) Suppose 'specs' is a struct with 4 fields: {file_dir, file_name, nlines,

    my_line}. Use if?end or if?elseif?end statements to check that:
    1. 'specs'isindeedastruct.
    2. Thefourfieldsaboveallexist.
    3. Thefields'file_dir','file_name'are(non?empty)strings

  3. c) You should use the 'error' function to indicate an error if your checks above fail.

  4. d) Now suppose you have a directory whose name is stored in 'specs.file_dir' which contains a file whose name is stored in 'specs.file_name'. You should assume that you have a simple text file which contains text (NOT numeric data).

  5. e) Your function should open the file (hint: use fopen), and read 'specs.nlines' number of lines (rows) from the file into a cell array 'C'. Each element of C should contain one line from your file. You can assume that there are no errors in the parameter 'specs.nlines', that is, it cannot exceed the number of lines in your file.

  6. f) Suppose 'specs.my_line' specifies some line number. The output parameter 'ret_line' should be set to this line (you should return a string).

  7. g) Verify that your code works by saving some text into a file (created in notepad / textedit) and saving the file with extension '.txt'. You should attach the file (call it 'test.txt') with your code.

 

 

Reference no: EM13163481

Questions Cloud

Write a flowchart to solve any linear equation ax+b=01. : Write a flowchart to solve any linear equation ax+b=01. W Write a flowchart to solve any linear equation ax^2+bx+C=0
What mass of cacl2 should the chemist use : A chemist wants to make 6.5L of a 0.310M CaCl2 solution.What mass of CaCl2 (in g) should the chemist use?
What mass of water contains of hydrogen : Water is composed of 11.2% hydrogen and 88.8% oxygen. What mass of water contains 16.0g of hydrogen?
Calculate the total execution time : Calculate the total execution time of a program consisting of 100 instructions for NIOS II/f(6-stage pipeline) if five instructions are branch instructions. Clock frequency is 50MHz. Consider two cases: (1) 100% success in branch prediction, (2) n..
Write a function named ''read_line'' : Verify that your code works by saving some text into a file (created in notepad / textedit) and saving the file with extension '.txt'. You should attach the file (call it 'test.txt') with your code.
Why is tetraphenylporphyrin : Why is tetraphenylporphyrin (TPP) so stable? Why is it planar? Why does it precopitate so easily?
How much water would you expect to vaporize : A 50.0 gram piece of iron at 152 degrees celsius is dropped into a 20.0 grams of Water at 89 degrees Celsius in an open thermally insulated container. How much water would you expect to vaporize, assuming no water splashes out?
Discuss why a make sense chart of accounts is important : Discuss why a "make sense" chart of accounts is important. Specifically, how can setting it up well help the company's managers and vice versa.
Kerfuffleboard is a game very much like shuffleboard : Kerfuffleboard is a game very much like Shuffleboard. Players take turns shooting disks at a trianglular scoring area. While the scoring areas are the same in shuffleboard and kerfuffleboard, a disk's contribution to a player's score will be calcu..

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Compute the economy sized svd

Compute the economy sized SVD of the reshaped A matrix.

  Pattern recognition

Research and discover more in-depth knowledge about topics in Pattern Recognition and choose a topic. The best topic will be the one you are most interested in or a topic from your research project you are working on.

  Matlab program to compute how much money will accumulate

Write a MATLAB program to compute how much money will accumulate in 5 years in the account and in any CDs you buy. Run the program for two different savings interest rates: 4 percent and 5 percent.

  Demonstrate the effect of zero-padding

Write a programs in Matlab to demonstrate the effect of zero-padding and filtering the DC-component in the frequency domain.

  Write a script to solve the following systems of equations

Write a script to solve the following systems of equations using both matrix left division (\) and the inverse matrix method and Show that you have tested your MATLAB code appropriately

  Linear support vector machine svm

Write a computer program to prepare a Linear Support Vector Machine SVM.

  Elementary numerical methods and programming

Project involes determining the dynamics of the double pendulum with a sliding base. Each link is assumed to be of square cross section - MECH 3010: Elementary Numerical Methods and Programming

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Z-transform in matlab

Z-Transform in MATLAB, Sketch the z-plane pole-zero plot and determine the stability status for the following digital system. Determine the h(n) in MatLab.

  Write a simple program that stores the high temperatures

A meteorological company wants you to write a simple program that stores the high temperatures and low temperates for each of the months of the year. After consulting with trusted programming partners, you come up with a great idea

  Filtering – biomedical application

Prepare a filter that removes noise produced by electronic medical equipment.

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd