Filter löschen
Filter löschen

Live script will not run code that "regular" script will

1 Ansicht (letzte 30 Tage)
Jon
Jon am 25 Okt. 2016
Kommentiert: Walter Roberson am 25 Okt. 2016
The following code works fine in SCRIPT, but it will not work in Live Script. I am wondering why?
I am running MATLAB 2016b, on an iMAC running OS X Sierra.
Thanks,
---jon---
----------------------------------------------
% A is a 6x2 numerical array. Col 1 has student IDs in it. Col 2 has
% corresponding test scores.
% Find the second largest score, and the ID of the
% student who received the second highest score.
% Assume no duplicate scores.
A = [11 45;
12 98;
13 71;
14 21;
15 34;
16 92];
[sortedScores, ndxSortedScores] = sort(A(:,2));
secondHighestScore = sortedScores(end-1)
ID_secondHighest = A( ndxSortedScores(end-1), 1)
  5 Kommentare
Walter Roberson
Walter Roberson am 25 Okt. 2016
The code works for me as Live Script in R2016b on Mac with El Capitan.
Walter Roberson
Walter Roberson am 25 Okt. 2016
The code works for me as Live Script in R2016b on Mac with Sierra in a Virtual Machine.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by