une question de débutant :)comment faire un tableau de nombres? (xcode)
J'essayais de faire un tableau de nombres. J'ai besoin d'appeler tous les éléments de ce tableau. (tableau [i]). Je l'ai fait comme ceci:
NSNumber *array[] = {@0.240128f , @0.240128f , @0.953934f , @1.181351f, @1.382523f, @1.497086f, @1.437790f , @0.851196f};
mais quand je fais appel de ce tableau, il me donne une erreur:
Expected method to read array element not found on object of type "NSNumber"
merci.
Code additionnel est passé d'un commentaire:
int SIZE = 97;
fftw_complex *data, *fft_result, *ifft_result;
fftw_plan plan_forward, plan_backward;
int i;
NSArray * array = @[@0.240128f , @0.240128f , @0.953934f , @1.181351f, @1.382523f, @1.497086f, @1.437790f , @0.851196f];
float a0 = [array[0] floatValue];
data = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * SIZE);
fft_result = ...
ifft_result = ...
plan_forward = ...
plan_backward ...
for(i = 0 ; i < SIZE ; i++) {
data[i][0] = array[i];
data[i][1] = 0.0;
}
'data [i] [0] = array [i],' 'doit être [array [i] floatValue];' – zaph
@Zaph VOUS RÉSOLVIONS, son travail, je traînais ici il y a deux jours :) merci beaucoup – josef