MATLAB Suppressing result using 'varname_' in Matlab

  • Thread starter Thread starter Heidis
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion revolves around a user encountering an issue in MATLAB where results from a loop are being printed in the command window despite using a semicolon to suppress output. The user is attempting to store matrices generated in a loop with dynamically named variables but is frustrated by the repeated output cluttering the command window. A suggested solution is to ensure that the semicolon is placed correctly in the eval statement to prevent output. The user expresses concern about the lack of responses, questioning whether the issue is due to the complexity of the problem or a general lack of understanding among peers. The conversation highlights the importance of proper syntax in MATLAB to manage output effectively, especially when dealing with large datasets in loops.
Heidis
Messages
2
Reaction score
0
Hey everybody
I have very recently learned the function 'varname_' for storing data with different names in a loop. My problem is that the result is written in the command window even though I have written ;.

My command looks like this

for run=237:273
[F,dt] = Dataimport(n,run);
eval(['F_' num2str((run-237)*10) '=F']);
clc
end

Since every F comming out of the function Dataimport is a 10x33,877 matrix I would very much like to stop Matlab from writing it 37 times (length of loop).

I have tried putting two ;; but that gave an error. Right now I'm just deleting the result for each loop but it still takes a lot of unnecessary power.

Can anyone help me and correct my mistake?

Regards Heidi
 
Physics news on Phys.org
How should I interpret the lak of response? Is it because you don't know how to solve the problem, maybe because this is just how Matlab has decided to do it, or because you cannot see why I'm even having this proplem?
Please let me know this as my script is increasing with more of these huge loops with new variables.
Regards Heidi
 
Instead of:

eval(['F_' num2str((run-237)*10) '=F']);

Try:

eval(['F_' num2str((run-237)*10) '=F;']);

Note the ; after F.
 

Similar threads

Replies
1
Views
4K
Replies
6
Views
2K
Replies
5
Views
1K
Replies
2
Views
4K
Replies
1
Views
10K
Replies
3
Views
3K
Back
Top