From a file to an answer
Most MATLAB code in the world is not a library or an application. It is analysis: someone has a file of measurements, from a sensor, a laboratory instrument, a simulation or a survey, and a question about it. The work always follows the same arc. Read the data in, find what is missing or wrong, summarise it, fit a model, look at it in pictures, and write up the answer in a form that someone else can check and rerun.
This last lesson follows that arc with the tools from the whole course: text and structs from lesson 5, least squares from lesson 6, root finding from lesson 7, and the functions, errors and tests of lesson 4. Along the way it describes plotting (the programs in this course are checked on a machine without a screen, so plots are shown as code and described in words), surveys the ecosystem of toolboxes, Simulink and Octave packages, compares MATLAB with Python and Julia, and ends with a complete project you can adapt to your own data.
One difference shapes the code. Modern MATLAB analysis is written around the table type, read with readtable and summarised with functions such as groupsummary, rmmissing and fillmissing. Octave 11 has none of these, so this lesson uses what both programs share: textscan, a struct with one field per column, and the core numerical functions. The ideas carry over directly when you meet tables.
Reading, cleaning and summarising data
A city puts a counter on a bicycle bridge and records daily riders, the day's high temperature and the rainfall. Here are two weeks of it, with one count and one temperature missing. The program writes the data to a temporary CSV file first, so that it can show the real reading step:
% Two weeks from a bicycle counter on a city bridge (illustrative data).
% Empty fields are readings the sensors missed.
csv = {'date,riders,high_c,rain_mm'
'2026-04-06,2410,18.5,0.0'
'2026-04-07,2530,20.1,0.0'
'2026-04-08,1620,14.2,12.4'
'2026-04-09,2280,16.8,1.2'
'2026-04-10,2350,19.0,0.0'
'2026-04-11,1710,21.3,0.0'
'2026-04-12,1480,17.6,3.5'
'2026-04-13,2490,19.4,0.0'
'2026-04-14,,18.0,0.0'
'2026-04-15,2610,22.5,0.0'
'2026-04-16,1890,15.1,8.0'
'2026-04-17,2300,,0.4'
'2026-04-18,1820,23.0,0.0'
'2026-04-19,1150,13.9,15.2'};
file = [tempname() '.csv'];
fid = fopen(file, 'w');
fprintf(fid, '%s\n', csv{:});
fclose(fid);
% Read it back the portable way: textscan, one cell per column.
fid = fopen(file, 'r');
C = textscan(fid, '%s %f %f %f', 'Delimiter', ',', 'HeaderLines', 1);
fclose(fid);
delete(file);
data = struct('day', datenum(C{1}, 'yyyy-mm-dd'), 'riders', C{2}, 'high', C{3}, 'rain', C{4});
fprintf('%d days; missing values: %d in riders, %d in high_c\n', ...
numel(data.day), nnz(isnan(data.riders)), nnz(isnan(data.high)));
% Summaries that skip missing values.
r = data.riders;
fprintf('riders: mean %.0f, median %.0f, std %.0f, range %d to %d\n', ...
mean(r, 'omitnan'), median(r, 'omitnan'), std(r, 'omitnan'), min(r), max(r));
% Group: weekend versus weekday, wet versus dry.
weekend = ismember(weekday(data.day), [1 7]); % 1 is Sunday, 7 Saturday
wet = data.rain >= 1;
groups = 1 + weekend + 2 * wet; % 1..4
labels = {'dry weekday', 'dry weekend', 'wet weekday', 'wet weekend'};
ok = ~isnan(r);
means = accumarray(groups(ok), r(ok), [4 1], @mean, NaN);
counts = accumarray(groups(ok), 1, [4 1]);
for g = 1:4
fprintf(' %-12s %d days, mean %5.0f\n', labels{g}, counts(g), means(g));
end
% Relationships: correlation and a linear model fitted by least squares.
complete = ok & ~isnan(data.high);
R = corrcoef(data.high(complete), r(complete));
fprintf('correlation of riders with temperature: %.2f\n', R(1, 2));
X = [ones(nnz(complete), 1), data.high(complete), data.rain(complete), weekend(complete)];
b = X \ r(complete);
fprintf('model: %.0f + %.1f per degree %+.1f per mm of rain %+.0f at weekends\n', b);
% Smoothing and ranking.
fprintf('3-day moving mean: %s\n', mat2str(round(movmean(r, 3, 'omitnan'))'));
valid = find(ok);
[~, k] = sort(r(valid), 'descend');
for i = valid(k(1:3))'
fprintf(' busy day: %s, %d riders\n', datestr(data.day(i), 'ddd dd mmm'), r(i));
end14 days; missing values: 1 in riders, 1 in high_c
riders: mean 2049, median 2280, std 464, range 1150 to 2610
dry weekday 6 days, mean 2448
dry weekend 2 days, mean 1765
wet weekday 3 days, mean 1930
wet weekend 2 days, mean 1315
correlation of riders with temperature: 0.51
model: 1492 + 47.5 per degree -30.9 per mm of rain -707 at weekends
3-day moving mean: [2470 2187 2143 2083 2113 1847 1893 1985 2550 2250 2267 2003 1757 1485]
busy day: Wed 15 Apr, 2610 riders
busy day: Tue 07 Apr, 2530 riders
busy day: Mon 13 Apr, 2490 ridersWhat each part shows:
- Reading.
textscanreads text according to a format, one%code per column, and returns a cell array with one cell per column:C{1}is a cellstr of dates andC{2}toC{4}are numeric columns. Empty fields becomeNaN.HeaderLinesskips the header andDelimitersets the separator. Alwaysfclosewhat youfopen. For purely numeric files,dlmreadandcsvreadare quicker; MATLAB's newerreadmatrixandreadtableare not in Octave 11. - A struct of columns stands in for a table:
data.ridersis a column vector you can compute with directly. The dates become serial date numbers withdatenum(days counted from year 0), which can be subtracted, compared and turned back into text withdatestr. (MATLAB'sdatetimetype, recommended there today, is another thing Octave lacks.) - Missing values.
NaNmarks them,isnanfinds them, and'omitnan'makesmean,median,std,sumandvarskip them in both programs.minandmaxskipNaNby default. - Grouping. Two logical columns, weekend and wet, are combined into a group number from 1 to 4, and
accumarraycomputes a count and a mean per group, the pattern from lesson 5. The table already tells a story: dry weekdays are busiest, and rain cuts weekend riding hardest. - Relationships.
corrcoefreturns a correlation matrix; the off-diagonal entry, 0.51, is a moderate positive correlation with temperature. The linear model, fitted by least squares with backslash on the 12 days that have both a count and a temperature, estimates about 48 more riders per degree, 31 fewer per millimetre of rain and 700 fewer at weekends. With 12 observations and 4 coefficients, treat these as rough descriptions, not laws. - Smoothing and ranking.
movmeanaverages each day with its neighbours (the window shrinks at the ends), here skipping the missing day. To find the busiest days, the program sorts only valid entries, becausesortwith'descend'putsNaNfirst in both programs.
Plotting
Graphics are a large part of why people choose MATLAB, and Octave's plotting commands are largely the same. A typical figure for the bicycle data, saved as an image file:
fig = figure('Visible', 'off'); % no window: right for scripts and servers
subplot(2, 1, 1);
plot(data.day, data.riders, 'o-', ...
data.day, movmean(data.riders, 3, 'omitnan'), '-', 'LineWidth', 1.5);
datetick('x', 'dd mmm');
ylabel('riders per day');
legend('daily count', '3-day mean', 'Location', 'southwest');
grid on;
subplot(2, 1, 2);
scatter(data.high, data.riders, 40, data.rain, 'filled');
xlabel('high temperature (C)');
ylabel('riders per day');
cb = colorbar;
ylabel(cb, 'rain (mm)');
print(fig, 'riders.png', '-dpng', '-r150'); % 150 dots per inch
close(fig);The top panel would show the daily counts as dots joined by a line, dipping on the rainy days (most sharply on Wednesday 8 April) and at both weekends, with the smoother three-day mean running through them and the dates labelled along the bottom. The bottom panel is a scatter plot: each day is a dot placed by temperature and riders and coloured by rainfall (yellow for the wettest, with the default colour map of either program), so the wet days stand out as low dots on the cool side, the picture behind the correlation and the model.
The building blocks are few. plot(x, y, style) draws lines and markers ('o-' is circles joined by lines; 'r--' a red dashed line), and several x-y pairs can share one call. hold on keeps adding to the same axes. bar, scatter, histogram (MATLAB) or hist (Octave), errorbar, area and stairs cover most charts; surf, mesh, contour and imagesc show functions of two variables and images, usually with grids from meshgrid. Every plot needs labelled axes with units; a legend when there is more than one series; and a title or caption that says what the reader should notice.
Differences to know: tiledlayout, nexttile, yyaxis, exportgraphics and sgtitle are MATLAB-only in Octave 11, so use subplot, print or saveas for portable code. Octave draws with its own graphics toolkits (Qt by default), so fonts, colours and spacing look somewhat different from MATLAB's figures even when the code is the same. For papers and reports, both programs can save vector formats (-dpdf, -dsvg) that stay sharp at any size.
Project: a year of temperatures, from raw file to tested report
The project brings everything together. The task: a weather logger has produced a CSV file of daily maximum temperatures for a year. Some days are missing, a couple of readings are faulty, and you are asked for a short, reliable summary: the typical seasonal cycle, when the warm season starts, how many hot days there were, and the monthly means, in a form a person can read and a program can load.
In a real project the code would be split into files like this, with the functions in a package folder (lesson 4) and the data and results kept apart from the code:
weather-report/
run_report.m the driver script: read, clean, fit, report
+weather/
readDaily.m one function per file, called as weather.readDaily(...)
cleanDaily.m
fitSeason.m
tests/ checks against data with a known answer
data/ raw input files, never edited by hand
results/ generated output, safe to delete and regenerateTo make it runnable in one piece here, everything sits in a single Octave script, with the functions first. Since we have no real logger, the first function writes a stand-in file: a known seasonal curve plus noise from a simple, repeatable random-number generator, with gaps and two faults. Knowing the truth behind the data lets the program test the whole pipeline at the end.
1; % Octave layout: functions first (see lesson 4)
% ---------- Data: a stand-in for the file you would receive ----------
function writeSyntheticYear(file)
% WRITESYNTHETICYEAR A year of daily maximum temperatures as CSV, from a
% known seasonal curve plus repeatable noise, with gaps and two faults.
n = (1:365)';
truth = 16 + 9 * cos(2 * pi * (n - 200) / 365);
noise = zeros(365, 1);
seed = 2026;
for i = 1:365 % Park-Miller generator: same in every program
u = zeros(1, 12);
for j = 1:12
seed = mod(16807 * seed, 2^31 - 1);
u(j) = seed / (2^31 - 1);
end
noise(i) = 2.5 * (sum(u) - 6); % roughly normal, standard deviation 2.5
end
tmax = round((truth + noise) * 10) / 10;
tmax([50:53, 120]) = NaN; % the logger was offline
tmax(210) = 85.0; % a reading in Fahrenheit by mistake
tmax(300) = -40.0; % a disconnected sensor
dates = cellstr(datestr(datenum(2025, 1, 1) + n - 1, 'yyyy-mm-dd'));
fid = fopen(file, 'w');
fprintf(fid, 'date,tmax_c\n');
for i = 1:365
if isnan(tmax(i))
fprintf(fid, '%s,\n', dates{i});
else
fprintf(fid, '%s,%.1f\n', dates{i}, tmax(i));
end
end
fclose(fid);
end
% ---------- The analysis: small functions, each with one job ----------
function d = readDaily(file)
% READDAILY Read a date,value CSV into a struct of column vectors.
fid = fopen(file, 'r');
if fid < 0
error('weather:file', 'cannot open %s', file);
end
C = textscan(fid, '%s %f', 'Delimiter', ',', 'HeaderLines', 1);
fclose(fid);
d = struct('date', datenum(C{1}, 'yyyy-mm-dd'), 'tmax', C{2});
end
function [d, info] = cleanDaily(d, limit)
% CLEANDAILY Remove readings far from their neighbours, then fill gaps.
local = movmedian(d.tmax, 7, 'omitnan');
outlier = abs(d.tmax - local) > limit;
d.tmax(outlier) = NaN;
gap = isnan(d.tmax);
d.tmax(gap) = interp1(d.date(~gap), d.tmax(~gap), d.date(gap), 'linear');
info = struct('outliers', find(outlier)', 'filled', nnz(gap));
end
function fit = fitSeason(t, y)
% FITSEASON Least-squares fit of y = a + b*cos(w*t) + c*sin(w*t), t in days.
w = 2 * pi / 365;
X = [ones(size(t)), cos(w * t), sin(w * t)];
coef = X \ y;
fit.mean = coef(1);
fit.amplitude = hypot(coef(2), coef(3));
fit.peakDay = mod(atan2(coef(3), coef(2)) / w, 365);
fit.residualStd = std(y - X * coef);
fit.curve = @(s) coef(1) + coef(2) * cos(w * s) + coef(3) * sin(w * s);
end
% ---------- The driver script ----------
file = [tempname() '.csv'];
writeSyntheticYear(file);
raw = readDaily(file);
delete(file);
[d, info] = cleanDaily(raw, 10);
dayOfYear = d.date - d.date(1) + 1;
fit = fitSeason(dayOfYear, d.tmax);
[~, monthOfYear] = datevec(d.date);
monthly = accumarray(monthOfYear, d.tmax, [12 1], @mean);
warmFrom = fzero(@(t) fit.curve(t) - 20, [1 fit.peakDay]);
fprintf('Read %d days; %d missing; outliers removed on days %s; %d values filled.\n', ...
numel(raw.tmax), nnz(isnan(raw.tmax)), mat2str(info.outliers), info.filled);
fprintf('Seasonal fit: mean %.1f C, amplitude %.1f C, warmest around day %.0f (%s).\n', ...
fit.mean, fit.amplitude, fit.peakDay, datestr(d.date(1) + round(fit.peakDay) - 1, 'dd mmm'));
fprintf('Day-to-day scatter around the curve: %.1f C.\n', fit.residualStd);
fprintf('The typical maximum first reaches 20 C on day %.0f (%s).\n', ...
warmFrom, datestr(d.date(1) + ceil(warmFrom) - 1, 'dd mmm'));
fprintf('%d days reached 25 C or more.\n', nnz(d.tmax >= 25));
fprintf('Monthly means: %s\n', mat2str(round(monthly' * 10) / 10));
% Tests: the synthetic data were built from a known truth, so check against it.
assert(info.filled == 7, 'expected five gaps and two outliers to be filled');
assert(isequal(info.outliers, [210 300]), 'the two faults should be detected');
assert(abs(fit.mean - 16) < 0.5 && abs(fit.amplitude - 9) < 0.5, 'fit far from truth');
assert(abs(fit.peakDay - 200) < 5, 'peak day far from truth');
disp('All checks passed.')
summary = struct('mean', fit.mean, 'amplitude', fit.amplitude, ...
'peakDay', fit.peakDay, 'monthly', monthly');
summary = structfun(@(v) round(v * 10) / 10, summary, 'UniformOutput', false);
disp(jsonencode(summary))Read 365 days; 5 missing; outliers removed on days [210 300]; 7 values filled.
Seasonal fit: mean 15.9 C, amplitude 9.4 C, warmest around day 200 (19 Jul).
Day-to-day scatter around the curve: 2.5 C.
The typical maximum first reaches 20 C on day 135 (15 May).
37 days reached 25 C or more.
Monthly means: [7.2 6.4 10.9 15.7 20.3 24.1 24.9 23.7 20.9 16.2 12 8.2]
All checks passed.
{"mean":15.9,"amplitude":9.4,"peakDay":200,"monthly":[7.2,6.4,10.9,15.7,20.3,24.1,24.9,23.7,20.9,16.2,12,8.2]}Walking through the design:
- Repeatable synthetic data.
randandrandnproduce different streams in MATLAB and Octave, even with the same seed. The Park–Miller generator, a single multiply-and-remainder per number, produces identical numbers everywhere, and summing twelve uniform numbers gives a good approximation to normal noise. Testing an analysis on synthetic data with a known answer, before trusting it on real data, is standard practice. - One function, one job.
readDailyonly reads (and raises an identified error if the file is missing),cleanDailyonly cleans,fitSeasononly fits. Each could be tested and reused alone, and the driver reads like a summary of the method. - Cleaning with a robust rule. A reading is an outlier if it differs by more than 10 degrees from the median of its seven-day neighbourhood. The median, unlike the mean, is not dragged along by the outlier itself. Both faults are caught and nothing else is. Gaps, original and new, are filled by linear interpolation with
interp1between the neighbouring days, andinforecords what was changed, because a cleaning step that changes data silently is a trap for the next reader. - A model with meaning. The seasonal cycle is fitted as with : linear in , and , so backslash solves it, as in lesson 6. The amplitude and the phase from
atan2turn the coefficients into quantities a reader understands: an average of 15.9 °C, a swing of 9.4 °C either side, warmest around 19 July. The scatter of 2.5 °C around the curve matches the noise that was put in. - Numerical methods as questions. "When does the typical maximum first reach 20 °C?" is a root-finding problem on the fitted curve, solved with
fzeroon a bracket from day 1 to the peak. The fitted curve is stored in the struct as a function handle,fit.curve, so the driver can ask such questions later. - Built-in tests. The
assertlines check the results against the known truth. They are deliberately loose (the fit recovers 9.4 for a true amplitude of 9, because the noise is real noise), and they would catch a broken cleaning step or a sign error in the phase immediately. In a real project these become test files run byruntestsin MATLAB or%!blocks in Octave, and run on every change. - Output for people and for programs. The text report is for a reader; the JSON summary, rounded with
structfunapplied to every field, is for the next program, which might be a web page or a Python script.
Two plots would complete the report: the cleaned daily values as dots with the fitted curve as a line through them (plot(d.date, d.tmax, '.', d.date, fit.curve(dayOfYear), '-')), and a bar chart of the monthly means (bar(1:12, monthly)), saved with print into the results folder.
Toolboxes, Simulink and Octave packages
Much of MATLAB's value lies outside the core language, in toolboxes: separately licensed collections of functions and apps for a field. Among the most used are the Signal Processing, Control System, Optimization, Statistics and Machine Learning, Image Processing, Deep Learning, Symbolic Math and Parallel Computing toolboxes. They are well documented, tested together, and supported by MathWorks, which is a large part of what companies pay for. Code that calls a toolbox function runs only where that toolbox is installed, so check ver (which lists installed products) before sharing code.
Simulink is a different kind of tool: a graphical environment in which you model a dynamic system as a block diagram of integrators, gains, transfer functions, switches and subsystems, and simulate it over time with ODE solvers like those of lesson 7. Its main use is model-based design in industries that build control systems, such as automotive, aerospace, energy and industrial automation: engineers model the plant and its controller, test the controller in simulation, generate C code for the real embedded processor from the model (with Embedded Coder), and test that code against the model. Related products add state machines (Stateflow) and physical modelling (Simscape). There is no Simulink in Octave; free tools for block-diagram and equation-based modelling include Xcos, part of Scilab, and OpenModelica.
Octave's answer to toolboxes is its packages, written by volunteers and listed in the Octave packages index. The best known are signal, control, statistics, optim, image, io (spreadsheets and other formats) and symbolic (built on Python's SymPy). They cover a useful part of the corresponding toolboxes, with smaller scope and less polish. Install a package once and load it in every session that uses it:
>> pkg install -forge signal % download and install from the index
>> pkg load signal % make its functions available now
>> pkg list % what is installedWorking with Python and Julia
MATLAB and Octave rarely live alone. Data arrives from Python pipelines, results go to web dashboards, and teams mix languages. The simplest bridge is a file format both sides read: CSV for tables, JSON for structured results (as in the project), and MATLAB's own MAT-files for arrays. In Octave, save('-v7', 'results.mat', 'monthly', 'summary') writes a file MATLAB reads, and Python's SciPy reads it with scipy.io.loadmat. (MATLAB's newest MAT format, version 7.3, is based on HDF5, which Python reads with h5py.)
Direct calls are possible too. MATLAB can call Python libraries by prefixing their names with py., as in py.numpy.linspace(0, 1, 5), and the MATLAB Engine API for Python lets a Python program start MATLAB and call its functions. From Python, the oct2py package drives Octave the same way, and the pythonic Octave package lets Octave call Python.
The real question is often which language to use at all. As of 2026, the two main free alternatives for this kind of work are Python with NumPy and SciPy, and Julia:
| MATLAB / Octave | Python + NumPy | Julia | |
|---|---|---|---|
| First index | 1 | 0 | 1 |
| Matrix product | A * B | A @ B | A * B |
| Element-wise product | A .* B | A * B | A .* B |
| Solve a linear system | A \ b | np.linalg.solve(A, b) | A \ b |
B = A, then change B | A unchanged (copy) | A changes (same array) | A changes (same array) |
| Memory order | column-major | row-major by default | column-major |
| Fast loops | MATLAB: JIT; Octave: slow | slow in plain Python | compiled, fast |
| Cost | MATLAB licence; Octave free | free | free |
Python is a general-purpose language with an enormous ecosystem: NumPy and SciPy for numerics (scipy.integrate.solve_ivp defaults to the same Dormand–Prince method as ode45), pandas for tables, Matplotlib (whose pyplot interface was modelled on MATLAB's plotting commands), and the dominant machine-learning libraries. It is the usual choice when the analysis must become part of a larger software system, or for data science and AI. Julia, first released in 2012 and designed partly with MATLAB users in mind, keeps 1-based indexing, column-major arrays and A \ b, uses dots for element-wise operations, and compiles code just in time, so loops run at C-like speed without vectorising. It shines for new high-performance numerical and scientific code, with excellent differential-equation libraries.
MATLAB remains the strongest choice where its toolboxes and Simulink are the standard (control engineering, signal processing, much of automotive and aerospace work), where an organisation already has licences, models and code, and in teaching, where its integrated environment and documentation help beginners. Octave is the way to run and learn that code freely. Many engineers end up using two of these languages, and the habits from this course, thinking in arrays, checking sizes, solving rather than inverting, verifying numerical results, carry across all of them.
Where to go next
- Read the manuals. Both the Octave manual and the MathWorks documentation are thorough and full of examples;
helpanddocat the prompt reach them directly. MathWorks also offers free, self-paced introductory courses on its website. - Go deeper in numerical computing. Cleve Moler's Numerical Computing with MATLAB (see lesson 6) explains the algorithms behind backslash,
fzero,integraland the ODE solvers, with code. Lumenary Math's numerical methods topic covers the mathematics. - Learn your field's toolbox or package, whether signal processing, control, statistics or image processing, starting from its getting-started guide.
- Build something real. Take a data set you care about, from your studies, your work or public open data, and redo this lesson's project on it: read, clean, summarise, model, plot, test and report.
Common misconceptions
Misconception
"mean ignores missing values." By default, a single NaN makes mean, sum, std and var return NaN. Pass 'omitnan', or remove the missing values first. (min and max are the exceptions: they skip NaN by default.)
Misconception
"Correlation shows that temperature causes cycling." A correlation coefficient measures how closely two variables move together. Warm days might also be school holidays, or fall later in spring, when more people ride anyway. Models describe data; claims about causes need study design.
Misconception
"Code that runs in Octave will run in any MATLAB installation." Functions such as fsolve and those of Octave's packages correspond to MATLAB toolboxes that a given installation may not have, and some Octave syntax is not valid MATLAB (lesson 1). Test shared code where it will run.
Misconception
"A plot is the last step." Plot early and often. Looking at the raw data would have shown the 85 °C reading in the project at once; plots catch problems that summary statistics hide.
Exercises
1. Data analysis, plotting and a complete project
Warm-upComputationalWhat does this print?
x = [4 NaN 8];
fprintf('%g %g %g\n', mean(x), mean(x, 'omitnan'), max(x));
2. Data analysis, plotting and a complete project
CoreComputationaltextscan can also read from a char array. What does the first disp show? Write the three values separated by spaces.
C = textscan(sprintf('a,1\nb,\nc,3\n'), '%s %f', 'Delimiter', ',');
disp(C{2}')
3. Data analysis, plotting and a complete project
CoreComputationalWhat does this display? Write the numbers separated by spaces.
g = [1 2 1 3 2];
v = [10 20 30 40 50];
disp(accumarray(g', v')')
4. Data analysis, plotting and a complete project
CoreComputationalWhat does this display?
[s, k] = sort([5 NaN 9 1], 'descend');
disp(k(1))
5. Data analysis, plotting and a complete project
CoreComputationalA temperature series has one faulty reading. What is the third element of movmedian(x, 3)?
x = [20 21 85 22 23];
6. Data analysis, plotting and a complete project
Warm-upHumanIn Python with NumPy, A and B are 3-by-3 arrays. Which MATLAB expression computes the same thing as NumPy's A * B?
7. Data analysis, plotting and a complete project
CoreHumanYou translate this MATLAB code line by line into Python with NumPy (or into Julia), with A an array:
B = A;
B(1) = 0;
After the translated lines run, what has happened to A?
8. Data analysis, plotting and a complete project
StretchHumanWhich of these functions can a script call if it must run both in Octave 11 (no packages loaded) and in a MATLAB installation with no toolboxes? Choose all that apply.
Further reading and resources
- GNU Octave manual: Simple File I/Osave, load and the file formats Octave can write, including MATLAB's.
- GNU Octave manual: Basic Statistical Functions
- GNU Octave manual: Plotting
- Octave packagesThe index of community packages, such as signal, control, statistics, optim and symbolic.
- MathWorks documentationThe documentation for MATLAB, every toolbox and Simulink; search for "Call Python from MATLAB" and "MATLAB Engine API for Python".
- NumPy for MATLAB usersNumPy's own translation table between the two.
- Julia manual: Noteworthy differences from other languagesIncludes a section on differences from MATLAB.
- oct2pyA Python package for calling Octave from Python.