This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
n = ceil(100*rand());
v = rand(1,n);
v_correct = v';
assert(isequal(question(v),v_correct));
myAns =
0.2569
0.8974
0.5317
0.3863
0.6873
0.7663
0.5631
0.1966
0.9025
0.6119
0.1436
0.4531
0.7937
0.2149
0.9372
0.0169
0.9211
0.6980
0.5003
0.5950
0.7059
0.3413
0.6465
0.7637
0.1445
0.4658
0.5741
0.2194
0.9818
0.6023
0.7374
0.8814
0.1192
0.0143
0.2513
0.6125
0.8563
0.0112
0.5643
0.0980
0.4092
0.4700
0.6911
0.2039
0.3694
0.9256
0.9168
0.7532
0.6436
0.8959
0.2969
0.9596
0.2827
0.4359
0.1790
0.6769
0.0781
0.0145
0.5810
0.4639
0.4670
0.2894
0.2545
0.8828
0.0353
0.7236
0.1791
0.4363
0.0835
0.9884
0.1476
0.7306
0.5725
0.1902
0.3121
0.6608
0.6398
0.0507
0.5843
0.8463
0.1692
0.5383
|
2 | Pass |
fid = fopen('question.m');
line1=fgetl(fid);
line2=fgetl(fid);
line3=fgetl(fid);
fclose(fid);
assert(strcmp('function myAns = question(v)',line1),'Only change the lines you are asked to');
assert(strcmp(' %%%%%',line2),'Only change the lines you are asked to');
assert(strcmp(' %%%%% Place your code below. DO NOT change anything outside the region %%%%',line3),'Only change the lines you are asked to');
|
Convert a vector into a number
503 Solvers
203 Solvers
315 Solvers
2455 Solvers
664 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!