Values in cell array keep getting overwritten
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
1 vote
18 Comments
- for some unknown reason you decided to add another exist call after loading the file data. Consider the two possibilities a) if the file does not exist, then trying to import its data will throw an error, so your check does nothing, or b) if the file does exist, then load has already imported its data, in which case your exist is total superfluous. That is why my code already checked if the file exists before loading its data.
- You included the part of the code that actually stores the imported data in an if statement that runs only when the file does not exist (how do you imagine storing data from non-existent files?)... but this is all nested inside my original if statement which already checks if the file exists: can you tell me how it is ever possible for both if statements to have true conditions? i.e. for your if statement to run, a file has to both exist and not exist. Perhaps you are checking for Schroedinger's file?

- at the end of your script,
- in the command window.
More Answers (1)
0 votes
1 Comment
- the use of cd (slow, difficult to debug), rather than absolute/relative filenames.
- string concatenation instead of fullfile.
- loading directly into the workspace.
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)