octave - 如何在 OSX 10.6.8 上以 Octave 打开 .m 文件

标签 octave osx-leopard

这个文件 ex1.m,我用 Octave “打开”,但它什么也没做。前几行代码是....

%% 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;

等...还有更多文件,我不确定如何让它运行...

最佳答案

这看起来像是 Andrew Ng 在 www.coursera.org 提供的在线机器学习类(class)的一部分。在尝试自己学习教程后,您可能会更幸运地在类(class)网站的论坛上提出这些问题。

您首先需要在目录中拥有所有相关文件。然后真正完成任务。在您完成代码部分之前,大部分作业都不会执行任何操作。

此文件包含可帮助您开始线性练习的代码。您将需要在此练习中完成以下功能:

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

完成后,打开 mac 终端并 cd 到 ex1.m 所在的目录。您可以通过启动 octave 并输入 .m 扩展名的文件名来运行该程序。输入 ex1。或者,如果您不想在程序运行完毕后进入 Octave shell,则可以从终端输入 octave -q ex1.m

关于octave - 如何在 OSX 10.6.8 上以 Octave 打开 .m 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13998630/

相关文章:

matlab - 从第二中心矩计算对象统计

mono - 从 Mac OS X v10.5 Leopard 卸载 Mono

iphone开发-豹子还是雪豹?

macos - 用于开发 Mac 应用程序的正确编程语言

macos - os X 上的 mpirun

matlab - 使用 Octave\MatLab 进行 ML 梯度下降成本函数的简单演算到底是如何工作的?

octave - 如何在不使用for循环的情况下对矩阵的每一行进行运算?

objective-c - 带有自定义单元格的 NSTableView

function - matlab:fmincon,将变量传递给nonlcon

64-bit - Windows 上的 64 位版本的 Octave