Hi all,(adsbygoogle = window.adsbygoogle || []).push({});

I've created a structure containing various fields of data. The data in these fields is stored in matrices and is be added to at regular intervals. I'd like the system to identify the amount of inputs the fields already contain and then extend said matrices to include this new data.

The program concerns the monitoring of plant growth.

The code below works fine but requires the user to know the amount of measurements that have already been input. I'd like to avoid this as it could easily lead to data being overwritten:

id = input('Enter plant number: ');

iteration = input('Enter iteration: ');

plant(id).entryDate(iteration) = {date};

plant(id).height(iteration) = [height]; % The variable height is already in the workspace

My idea for ensuring new data is stored in the correct place was to use numel function, something like the following (removing the user-input value of 'it' from above):

previous_iterations = numel(plant(id).height);

it = previous_iterations + 1;

I can't this this or anything similar to work.

Thanks very much for your time, I'd greatly appreciate any help.

Craig

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab: dynamic data entry into structure

Loading...

Similar Threads for Matlab dynamic data |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

MATLAB Matlab data into bins |

**Physics Forums | Science Articles, Homework Help, Discussion**