Bird
0
0

Which of the following is the correct syntax to write a matrix M to a CSV file named 'data.csv'?

easy📝 Syntax Q3 of 15
MATLAB - File I/O
Which of the following is the correct syntax to write a matrix M to a CSV file named 'data.csv'?
Awritematrix(M, 'data.csv');
Bcsvwrite('data.csv', M);
Cwritecsv(M, 'data.csv');
Dwrite(M, 'data.csv');
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct function for writing matrix to CSV

    In modern MATLAB, writematrix is the recommended function to write matrices to CSV files.
  2. Step 2: Check syntax correctness

    The syntax writematrix(M, 'data.csv'); correctly specifies the matrix and filename.
  3. Final Answer:

    writematrix(M, 'data.csv'); -> Option A
  4. Quick Check:

    Correct syntax for writing matrix = writematrix(M, 'filename') [OK]
Quick Trick: Use writematrix with matrix and filename to save CSV [OK]
Common Mistakes:
  • Using non-existent writecsv function
  • Incorrect argument order
  • Using write instead of writematrix

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes