HSG-MCS-HS21_Julia/Exam1/Exam2021_1_Feedback.jl

23 lines
411 B
Julia

using Printf
include("jlFiles/printmat.jl")
println("Three ways of doing the same thing")
fp = [1 2;
1.1 2.1]
x1 = fp*10 #easiest and fastest
printmat(x1)
x2 = map(i->fp[:,i]*10,1:2) #cumbersome
x2 = hcat(x2...)
printmat(x2)
x3 = zeros(size(fp)) #even more cumbersome
for i=1:size(fp,1),j=1:size(fp,2)
x3[i,j] = fp[i,j]*10
end
printmat(x3)