[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
warning: implicit conversion from matrix to string
From: |
Vic Norton |
Subject: |
warning: implicit conversion from matrix to string |
Date: |
Tue, 2 Sep 2008 20:31:24 -0400 |
How do I get rid of implicit conversion warnings when printing an
array of strings of the same length? For example the script
% test2.m
global SEC_PER_HOUR = 3600;
SEC_PER_DAY = 24 * SEC_PER_HOUR;
SEC_PER_WEEK = 7 * SEC_PER_DAY;
function date = time2dateEST( time )
## The date returned is the "%Y-%m-%d"-formatted EST date
## corresponding to time.
global SEC_PER_HOUR;
time -= 5 * SEC_PER_HOUR;
date = strftime("%Y-%m-%d", gmtime( time ) );
endfunction
dates = zeros(5, 10);
time = 1082667600;
for i = 1 : 5
dates(i, :) = time2dateEST(time);
time += SEC_PER_WEEK;
endfor
for i = 1 : 5
printf("%s\n", dates(i, :));
endfor
produces
octave-3.0.2> test2
warning: implicit conversion from matrix to string
2004-04-22
warning: implicit conversion from matrix to string
2004-04-29
warning: implicit conversion from matrix to string
2004-05-06
warning: implicit conversion from matrix to string
2004-05-13
warning: implicit conversion from matrix to string
2004-05-20
on my system.
Obviously the dates have been "converted" correctly. What is the
problem here?
Regards,
Vic
- warning: implicit conversion from matrix to string,
Vic Norton <=