help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vectorise for loop in Octave


From: AURORA GONZALEZ VIDAL
Subject: vectorise for loop in Octave
Date: Mon, 11 May 2020 23:41:23 +0200
User-agent: Horde Application Framework 5

Hello!


I am trying to vectorise the for loops of a script to make it faster and some of them look like the following:

R = dlmread('Rp.csv');

for m = 1:4
  eval(['node' num2str(m) '= R(m,:);']);
end

Here I am creating the variables node1, node2, node3, node4. But I am not able to do it as follows:
 
clear
R = dlmread('Rp.csv');
eval(['node' num2str(1:4) '= R(1:4,:);']);

Any suggestions on how to vectorise it or make them faster?

Thank you very much for your time
 



---------------

Aurora González Vidal                      Ph.D. in Data Analytics for Energy Efficiency                                  President of Murcia R Users Association (UMUR)
T. +34 868 88 7866                             Department of Information and Communication Engineering                gauss.inf.um.es/umur
address@hidden                  Faculty of Computer Sciences
https://auroragonzalez.github.io/        University of Murcia                                                                                

Attachment: Rp.csv
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]