How to open .m files in octave on OSX 10.6.8

℡╲_俬逩灬. 提交于 2019-12-13 19:57:51

问题


This file ex1.m, I "open with" octave, but it doesn't do anything. the first few lines of code are....

%% Machine Learning Online Class - Exercise 1: Linear Regression

%  Instructions
%  ------------
% 
%  This file contains code that helps you get started on the
%  linear exercise. You will need to complete the following functions 
%  in this exericse:
%
%     warmUpExercise.m
%     plotData.m
%     gradientDescent.m
%     computeCost.m
%     gradientDescentMulti.m
%     computeCostMulti.m
%     featureNormalize.m
%     normalEqn.m
%
%  For this exercise, you will not need to change any code in this file,
%  or any other files other than those mentioned above.
%
% x refers to the population size in 10,000s
% y refers to the profit in $10,000s
%

%% Initialization
clear ; close all; clc

%% ==================== Part 1: Basic Function ====================
% Complete warmUpExercise.m 
fprintf('Running warmUpExercise ... \n');
fprintf('5x5 Identity Matrix: \n');
warmUpExercise()

fprintf('Program paused. Press enter to continue.\n');
pause;

etc.... There were more files, I'm not sure how to get this to run...


回答1:


This looks like part of Andrew Ng's Online Machine Learning class offered from www.coursera.org You might have more luck asking these questions in the forums at the class website after attempting to follow the tutorials yourself.

You need to have all of the relevant files in the directory first. Then actually complete the assignment. Most of those assignments do nothing until you complete the code section.

This file contains code that helps you get started on the linear exercise. You will need to complete the following functions in this exericse:

 warmUpExercise.m
 plotData.m
 gradientDescent.m
 computeCost.m
 gradientDescentMulti.m
 computeCostMulti.m
 featureNormalize.m
 normalEqn.m

After you are done, open a mac Terminal and cd to the directory where ex1.m is located. You can run the program by starting octave and entering the name of the file without the .m extension. Type ex1. Alternatively, you could type octave -q ex1.m from the terminal if you don't want to be in the octave shell after the program is done running.



来源:https://stackoverflow.com/questions/13998630/how-to-open-m-files-in-octave-on-osx-10-6-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!