You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
No results from calculations in the command window
13 views (last 30 days)
Show older comments
Hi there,
For some reason I am not getting any output results in the command window. I click on run and no results appear in the command window from my script. Nor, is there any results in the workspace - even though there a lots of calculations. I have restarted my computer and still there is no change. The last thing I was doing was trying to create a MATLAB function. Also, in the editor tab the option to create a new scipt is faded out. So I can't access a new script. I have been using MATLAB online for months and I have never experienced this problem or any problem like it.
I am very confused and I do not know what is going wrong!
I hope someone can help?
Many thanks,
Scott
Accepted Answer
Star Strider
on 22 Jul 2025
I am not certain that I fully understasnd your problem.
MATLAB functions have their own workspaces, so variables local to the function will not appear in the workspace window.
I am not certain what you are doing, however be sure to actually call the function (with all appropriate arguments), and return as many outputs as the function produces, at least to troubleshoot this.
13 Comments
Scott Banks
on 22 Jul 2025
Hi Star Strider,
What I am saying is that I click on Run and no results appear in the command window from my script. The command window is just blank - no results from the script are appearing!
Star Strider
on 22 Jul 2025
Does this work if you run it in the Command Window:
>> a = 1; b = 2; a + b
Running it here produces --
a = 1; b = 3; a + b
ans = 4
In MATLAB Online, entering that line at the prompt and then hitting 'ENTER' produces the same result.
.
Scott Banks
on 22 Jul 2025
I just came back to MATLAB after a couple of hours break, and everything was working again until I tried to run my saved function. After trying to run my function its gone back to nothing apearing in the command window.
Yes, even running simple commands in the command window is not working, Star Strider.
Star Strider
on 22 Jul 2025
I'm a bit confused at this point.
What OS are you using and what version of MATLAB?
Does your code only work in MATLAB Online and not in your offline (personal computer) MATLAB installation? (MATLAB Online is currently R2024b Update 5. I just now checked.)
if so, uninstalling and reinstalling MATLAB may be yoiur only option.
Scott Banks
on 22 Jul 2025
I think I have found the problem:
In my function I have an option to select certain data. Here is the complete file.
function [Inflex] = inflection_point
Inflex01 = [-0.35;-0.10;0.10;0.30;0.50;0.75;1.20];
Inflex02 = [-0.50;0.15;0.25;0.35;0.45;0.60;0.95];
Inflex03 = [0.10;0.25;0.30;0.40;0.45;0.55;0.85];
Inflex04 = [0.20;0.30;0.35;0.40;0.45;0.50;0.80];
Inflex05 = [0.20;0.35;0.40;0.40;0.45;0.50;0.75];
Inflex06 = [0.25;0.35;0.40;0.45;0.45;0.50;0.70];
Inflex07 = [0.30;0.35;0.40;0.45;0.45;0.50;0.70];
Inflex08 = [0.30;0.40;0.45;0.45;0.45;0.50;0.65];
Inflex09 = [0.35;0.40;0.40;0.45;0.45;0.50;0.65];
Inflex1 = [0.35;0.40;0.40;0.45;0.45;0.50;0.65];
Inflex2 = [0.40;0.45;0.45;0.50;0.50;0.50;0.55];
Inflex3 = [0.45;0.45;0.45;0.50;0.50;0.50;0.55];
Inflex4 = [0.40;0.50;0.50;0.50;0.50;0.50;0.55];
Inflex5 = [0.40;0.50;0.50;0.50;0.50;0.50;0.55];
Storey = ['7';'6';'5';'4';'3';'2';'1'];
Khat01 = [Inflex01];
Khat02 = [Inflex02];
Khat03 = [Inflex03];
Khat04 = [Inflex04];
Khat05 = [Inflex05];
Khat06 = [Inflex06];
Khat07 = [Inflex07];
Khat08 = [Inflex08];
Khat09 = [Inflex09];
Khat1 = [Inflex1];
Khat2 = [Inflex2];
Khat3 = [Inflex3];
Khat4 = [Inflex4];
Khat5 = [Inflex5];
Tb = table(Storey,Khat01,Khat02,Khat03,Khat04,Khat05,Khat06,Khat07,Khat08,Khat09,Khat1,Khat2,Khat3,Khat4,Khat5)
Khat = input('Enter a value of Khat: ')
switch Khat
case (Khat >= 0) && (Khat <= 0.14)
disp(Tb(:,2))
case 0.2
disp(Tb(:,3))
case 0.3
disp(Tb(:,4))
case 0.4
disp(Tb(:,5))
case 0.5
disp(Tb(:,6))
case 0.6
disp(Tb(:,7))
case 0.7
disp(Tb(:,8))
case 0.8
disp(Tb(:,9))
case 0.9
disp(Tb(:,10))
case 1
disp(Tb(:,11))
case 2
disp(Tb(:,12))
case 3
disp(Tb(:,13))
case 4
disp(Tb(:,14))
case 5
disp(Tb(:,15))
end
end
Now, when I am in a different file and run this the command window like I said goes blank. However, if I enter say 0.8 in the command window I get the correct display.
Which is great!!!
The only annoying thing is that I don't get the message "Enter a value of Khat", like I do in the file for the inflection_point itself. The command window is empty with no prompt to input a value of Khat. Do you know why this is?
Star Strider
on 22 Jul 2025
Edited: Star Strider
on 22 Jul 2025
When I put your function in a script file that includes the command:
inflection_point
regardless of the number I supply in response to the prompt (that always shows up), I get:
Output argument "Inflex" (and possibly others) not assigned a value in the execution ...
You need to assign a value to 'Inflex' at an appropriate point in your code.
I'm not certain what your function actually is supposed to do, however using the ismember (or ismembertol) function or one of the interpolation functions might be appropriate in order to asssign a value to 'Inflex'. I can probably help with that if I know what you actually want to do.
The code I'm using (in its entirety) is:
% % % Scott_Banks_2025_07_22.m
Infles = inflection_point
function [Inflex] = inflection_point
Inflex01 = [-0.35;-0.10;0.10;0.30;0.50;0.75;1.20];
Inflex02 = [-0.50;0.15;0.25;0.35;0.45;0.60;0.95];
Inflex03 = [0.10;0.25;0.30;0.40;0.45;0.55;0.85];
Inflex04 = [0.20;0.30;0.35;0.40;0.45;0.50;0.80];
Inflex05 = [0.20;0.35;0.40;0.40;0.45;0.50;0.75];
Inflex06 = [0.25;0.35;0.40;0.45;0.45;0.50;0.70];
Inflex07 = [0.30;0.35;0.40;0.45;0.45;0.50;0.70];
Inflex08 = [0.30;0.40;0.45;0.45;0.45;0.50;0.65];
Inflex09 = [0.35;0.40;0.40;0.45;0.45;0.50;0.65];
Inflex1 = [0.35;0.40;0.40;0.45;0.45;0.50;0.65];
Inflex2 = [0.40;0.45;0.45;0.50;0.50;0.50;0.55];
Inflex3 = [0.45;0.45;0.45;0.50;0.50;0.50;0.55];
Inflex4 = [0.40;0.50;0.50;0.50;0.50;0.50;0.55];
Inflex5 = [0.40;0.50;0.50;0.50;0.50;0.50;0.55];
Storey = ['7';'6';'5';'4';'3';'2';'1'];
Khat01 = [Inflex01];
Khat02 = [Inflex02];
Khat03 = [Inflex03];
Khat04 = [Inflex04];
Khat05 = [Inflex05];
Khat06 = [Inflex06];
Khat07 = [Inflex07];
Khat08 = [Inflex08];
Khat09 = [Inflex09];
Khat1 = [Inflex1];
Khat2 = [Inflex2];
Khat3 = [Inflex3];
Khat4 = [Inflex4];
Khat5 = [Inflex5];
Tb = table(Storey,Khat01,Khat02,Khat03,Khat04,Khat05,Khat06,Khat07,Khat08,Khat09,Khat1,Khat2,Khat3,Khat4,Khat5)
Khat = input('Enter a value of Khat: ')
switch Khat
case (Khat >= 0) && (Khat <= 0.14)
disp(Tb(:,2))
case 0.2
disp(Tb(:,3))
case 0.3
disp(Tb(:,4))
case 0.4
disp(Tb(:,5))
case 0.5
disp(Tb(:,6))
case 0.6
disp(Tb(:,7))
case 0.7
disp(Tb(:,8))
case 0.8
disp(Tb(:,9))
case 0.9
disp(Tb(:,10))
case 1
disp(Tb(:,11))
case 2
disp(Tb(:,12))
case 3
disp(Tb(:,13))
case 4
disp(Tb(:,14))
case 5
disp(Tb(:,15))
end
end
% ========================================================================
.
EDIT -- Corrected typographical errors.
.
Star Strider
on 22 Jul 2025
Considering Help with Inequalities In Switch Statement are you still interested in pursuing this here?
I offered to help with respect to using various functions, depending on what you want to do (that I'm still not certain about). You could use any of several functions to determine what values(s) 'Inflex' is everntually assigned.
.
Scott Banks
on 22 Jul 2025
Thanks, Star Strider. I have now assigned a value to Inflex and all seems to be good now.
It quite long winded what I want to do, but I want to be able to extract any inflection point that is contained in the Table Tb and apply it to any column in a storey within a tall building (there's a much bigger picture here). Note: an inflection point in structural engineering is a point where the bending moment equals zero in the member.
Khat is a parameter that takes the mean stiffness of beams relative to the column stiffness. If Khat equals 0.6 for example, then the coresponding inflection points are found in the 7th column in the table Tb - for each of the 7 storeys. Thus, if I want to work on the 7th storey with Khat equaling 0.6, the percentage distance for the inflection point from the bottom of the storey is 25% (0.25 in the table). So you multiply the length of the column by 0.25, there you have the zero point bending moment.
Thus, again, I want to be able to extract any value from the table when I need to. There is still some way to go, so I will likely be asking for more help!
Star Strider
on 22 Jul 2025
Edited: Star Strider
on 22 Jul 2025
My pleasure.
I'm not certain what the variables in the table represent.
Do you want to interpolate between them to get a single value or interpolated vector for 'Inflex', or do you want to get the closest column to a specific value for 'Khat' to assign to 'Inflex'?
Here's an example of an interpolation approach --
Inflex = inflection_point
Tb = 7×15 table
Storey Khat01 Khat02 Khat03 Khat04 Khat05 Khat06 Khat07 Khat08 Khat09 Khat1 Khat2 Khat3 Khat4 Khat5
______ ______ ______ ______ ______ ______ ______ ______ ______ ______ _____ _____ _____ _____ _____
7 -0.35 -0.5 0.1 0.2 0.2 0.25 0.3 0.3 0.35 0.35 0.4 0.45 0.4 0.4
6 -0.1 0.15 0.25 0.3 0.35 0.35 0.35 0.4 0.4 0.4 0.45 0.45 0.5 0.5
5 0.1 0.25 0.3 0.35 0.4 0.4 0.4 0.45 0.4 0.4 0.45 0.45 0.5 0.5
4 0.3 0.35 0.4 0.4 0.4 0.45 0.45 0.45 0.45 0.45 0.5 0.5 0.5 0.5
3 0.5 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.5 0.5 0.5 0.5
2 0.75 0.6 0.55 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5
1 1.2 0.95 0.85 0.8 0.75 0.7 0.7 0.65 0.65 0.65 0.55 0.55 0.55 0.55
Khat = 0.4200
Inflex = 7×2 table
Storey Interpolated Value for Khat = 0.4200
______ ____________________________________
7 0.2
6 0.31
5 0.36
4 0.4
3 0.45
2 0.5
1 0.79
function [Inflex] = inflection_point
Inflex01 = [-0.35;-0.10;0.10;0.30;0.50;0.75;1.20];
Inflex02 = [-0.50;0.15;0.25;0.35;0.45;0.60;0.95];
Inflex03 = [0.10;0.25;0.30;0.40;0.45;0.55;0.85];
Inflex04 = [0.20;0.30;0.35;0.40;0.45;0.50;0.80];
Inflex05 = [0.20;0.35;0.40;0.40;0.45;0.50;0.75];
Inflex06 = [0.25;0.35;0.40;0.45;0.45;0.50;0.70];
Inflex07 = [0.30;0.35;0.40;0.45;0.45;0.50;0.70];
Inflex08 = [0.30;0.40;0.45;0.45;0.45;0.50;0.65];
Inflex09 = [0.35;0.40;0.40;0.45;0.45;0.50;0.65];
Inflex1 = [0.35;0.40;0.40;0.45;0.45;0.50;0.65];
Inflex2 = [0.40;0.45;0.45;0.50;0.50;0.50;0.55];
Inflex3 = [0.45;0.45;0.45;0.50;0.50;0.50;0.55];
Inflex4 = [0.40;0.50;0.50;0.50;0.50;0.50;0.55];
Inflex5 = [0.40;0.50;0.50;0.50;0.50;0.50;0.55];
Storey = ['7';'6';'5';'4';'3';'2';'1'];
Khat01 = [Inflex01];
Khat02 = [Inflex02];
Khat03 = [Inflex03];
Khat04 = [Inflex04];
Khat05 = [Inflex05];
Khat06 = [Inflex06];
Khat07 = [Inflex07];
Khat08 = [Inflex08];
Khat09 = [Inflex09];
Khat1 = [Inflex1];
Khat2 = [Inflex2];
Khat3 = [Inflex3];
Khat4 = [Inflex4];
Khat5 = [Inflex5];
Tb = table(Storey,Khat01,Khat02,Khat03,Khat04,Khat05,Khat06,Khat07,Khat08,Khat09,Khat1,Khat2,Khat3,Khat4,Khat5)
% Khat = input('Enter a value of Khat: ')
Khat = 0.42
Tba = [Tb{:,2} table2array(Tb(:,2:end))];
ival = [0 0.14 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 2 3 4 5];
inflx = interp1(ival.', Tba.', Khat);
Inflex = table(Storey,inflx(:), VariableNames={'Storey',sprintf('Interpolated Value for Khat = %.4f',Khat)});
% switch Khat
% case (Khat >= 0) && (Khat <= 0.14)
% disp(Tb(:,2))
% case 0.2
% disp(Tb(:,3))
% case 0.3
% disp(Tb(:,4))
% case 0.4
% disp(Tb(:,5))
% case 0.5
% disp(Tb(:,6))
% case 0.6
% disp(Tb(:,7))
% case 0.7
% disp(Tb(:,8))
% case 0.8
% disp(Tb(:,9))
% case 0.9
% disp(Tb(:,10))
% case 1
% disp(Tb(:,11))
% case 2
% disp(Tb(:,12))
% case 3
% disp(Tb(:,13))
% case 4
% disp(Tb(:,14))
% case 5
% disp(Tb(:,15))
% end
end
The online 'Run' facility doesn't permit any interactivity, so I defined 'Khat' internally here.
EDIT -- (22 Jul 2025 at 21:37)
Added 'interpolation approach'.
.
Scott Banks
on 22 Jul 2025
That's brilliant, Star Strider. I was just going to go for the closet column for a single value, If I would have used interpolation I would have probably tried to incorporate the formula - y = y1 + (x - x1)/(x2 - x1)*(y2 - y1). Which would have had much more code. Great one!
Star Strider
on 22 Jul 2025
Edited: Star Strider
on 23 Jul 2025
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
EDIT -- (23 Jul 2025 at 00:55)
Note that there are also stepwise interpolation methods available, notably 'previous', 'next', and 'nearest'.
.
More Answers (0)
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)