Run every element through a function and return a new array
Mostra commenti meno recenti
Hi, I have a 1000x1 table and I want to run every row through a function y=a*x+b-1 where a and be are constants, and x are the elements from the table. The result should be a new 1000x1 table. Can anybody help?
Cheers.
Risposta accettata
Più risposte (1)
Andrei Bobrov
il 16 Nov 2017
a = 3;
b = 4;
T_out = rowfun(@(x)a*x+b-1,T,'OutputV','data');
Categorie
Scopri di più su Tables in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!