Have a look at parseFloat() which reads the next float of a stream. If you know there are always 4, just do 4 successive myfile.parseFloat() into 4 variables.
(That link shows parseFloat() as being in Serial, but it works for the SD library too.)
The code below compiles but is not tested: can't find my SD card module right now.
Set your file name in the line marked ///<<<<<<<<<<<<<<<<<<<<<<<
It reads 4x floats into variables and prints them to the monitor. Then if there's more data it delay()s for a second then does the next line (edit: or more correctly the next 4 floats, regardless of lines), or else it ends.
(This test code is all in setup(). In real life you would probably want to move it into loop() and make it delay()-less.)
You didn't say what you want to do with the data, so you'll have to add that part yourself.
// https://forum.arduino.cc/index.php?topic=631096
// parse 4x floats out of an SD card file
// meltDown 12 august 2019
/*
BASED ON SD card file dump
This example shows how to read a file from the SD card using the
SD library and send it over the serial port.
The circuit:
SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)
created 22 December 2010
by Limor Fried
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
*/
#include <SPI.h>
#include <SD.h>
const int chipSelect = 4;
int myVar1;
int myVar2;
int myVar3;
int myVar4;
void setup()
{
Serial.begin(9600);
Serial.println(".... parse floats out of sd file ....");
Serial.print("Compiler: ");
Serial.print(__VERSION__);
Serial.print(", Arduino IDE: ");
Serial.println(ARDUINO);
Serial.print("Created: ");
Serial.print(__TIME__);
Serial.print(", ");
Serial.println(__DATE__);
Serial.println(__FILE__);
Serial.print("Initializing SD card...");
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("theDataFile.txt"); //<<<<<<<<<<<<<<<<<<<<<< set file name here
// if the file is available, read from it:
if (dataFile)
{
while (dataFile.available())
{
//parse the next 4 values out of the file:
myVar1 = dataFile.parseFloat();
myVar2 = dataFile.parseFloat();
myVar3 = dataFile.parseFloat();
myVar4 = dataFile.parseFloat();
//print them to the monitor:
Serial.println(myVar1);
Serial.println(myVar2);
Serial.println(myVar3);
Serial.println(myVar4);
delay(1000);
//go back to the top for the next line...
//or ....
}//while data available
Serial.println(".... no more data");
dataFile.close();
}// if datafile
// if the file isn't open, pop up an error:
else {
Serial.println("error opening the data file");
}
}//setup
void loop()
{
}