help-octave
[Top][All Lists]
Advanced

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

Re: Matrix manipulation


From: Francesco Potortì
Subject: Re: Matrix manipulation
Date: Thu, 21 Jun 2012 22:29:49 +0200

>Matrix looks like this (first number marks the row number and that is what I 
>am trying to preserve):
>251 70.196 69.02 26.275
>252 83.529 51.765 36.471
>253 10.98 53.333 38.824
>254 4.3137 69.804 20.392
>255 15.294 98.824 57.255
>
>The project I am working on is transforming colors between different color 
>spaces.
>First step is really simple and only requires me to divide columns two to four 
>by 100.
>
>This is my code:
>
>       RGB=dlmread("/Users/Knof/Desktop/Matrix.txt");
>
>       #Size of matrix
>       b=size(RGB);
>
>       #Matrix length
>       v=b(1,1);
>
>       #Divide by 100
>       for i=1:v
>               value(i,2:4)=(RGB(i,2:4)) /100;
>        end

RGB = load("/Users/Knof/Desktop/Matrix.txt");
RGB(:,2:4) /= 100;

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040  
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


reply via email to

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