Answered
writing text files with mix of variables and strings
The reason your file is empty is that you forgot to supply the fid to the fprintf function, which causes it to print the text to...

6 years ago | 0

| accepted

Answered
Problems trying to use bar
You can use the function below to create fake bars by using plot. This function accepts (nearly) all input arguments that plot a...

6 years ago | 0

| accepted

Answered
how do I create a function
You can use something like this: close all x1=rand(10,1); myfun(x1) x2=rand(10,1); myfun(x2) x3=rand(10,1); myfun(x3) x4...

6 years ago | 0

Answered
Import data from text file and delete blank rows, columns, headers and unnecessary values
T=readmatrix('data.txt','NumHeaderLines',4); T(:,1)=[];%remove row indices in first column

6 years ago | 0

Answered
How can I repeat this shape NxN times with a certain spacing between repeated shapes?
Make the coordinates depend on x1 and y1: x1=0.25; y1=0.25; draw_line_and_patch(x1,y1) function draw_line_and_patch(x1,y1,...

6 years ago | 0

Answered
Is it possible to access the lines of code from a pre built command
You mean a builtin Matlab function? That may be possible, but since it is bound by copyright you can't actually use that knowle...

6 years ago | 0

| accepted

Answered
Treatment G-code file
str = fileread('gcode.txt'); cell_str=strsplit(str,'\n') character = 'Z'; TF = contains(cell_str,character); line_num=find(T...

6 years ago | 1

| accepted

Answered
can you help me to find out whats wrong here??
If you want to do this, you will probably have to convert to a char array and then convert to a double array. %because this is ...

6 years ago | 0

Answered
Applying smoothing to image
A convolution may be what you need. mask=rand(3,3);mask=mask/sum(mask(:)); IM=uint8(randi(255,100,100)); IM2=convn(IM,mask,...

6 years ago | 0

Answered
How to compute centered moving average from an NxM array
You can use a convolution with a flat array as the second input. avg_val = convn(M(:,2), ones(30,1)/30, 'valid');

6 years ago | 0

Answered
slicing matrix in efficient way
Something like this should do the trick: a=1:120; b=reshape(a,10,3,[]); x=squeeze(b(:,1,:)); y=squeeze(b(:,2,:)); z=squee...

6 years ago | 0

| accepted

Answered
How to store values from push button and then add all values and display in a static text box
If you're using GUIDE for the first time: don't. Do not teach yourself a tool that will be removed from Matlab in one of the nex...

6 years ago | 0

| accepted

Answered
Adding a global legend to a tiledlayout
I can't get the position quite right, maybe you have more luck with your tinkering. This at least gets rid of the line. (I guess...

6 years ago | 1

| accepted

Answered
Replace values in matrix based on array values
Nobody is born knowing about ismember and ismembertol. (use the latter if you expect float rounding errors)

6 years ago | 0

Answered
Matrix multiplication, matrix with variables
If this code works, why not use this? Fin=T_vit*R_lens_post*T_lens*R_lens_ant*T_aqueous*R_cor_post*T_cornea*R_cor_ant; You als...

6 years ago | 0

| accepted

Answered
Creating text for subcaptions in subplot figure
Even for subplots you can use the title and xlabel functions. Your picture looks like you want to use xlabel. clc;clear; rng(4...

6 years ago | 0

Answered
Create matrix of maximum values from cell array
cellfun(@max,FR)

6 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #5 (and bug reports)
A soft-lock for questions, similar to StackExchange. This soft-lock would prevent low/no-reputation users (e.g. <5) from postin...

6 years ago | 1

Answered
How to Concetanate Arrays in a Struct?
You were close with your commented code. %see what this returns? MasterResult.Durchschnittswert %you can concatenate that c...

6 years ago | 2

| accepted

Answered
How do I vectorize this for loop?
You will need to convert to linear indices with sub2ind.

6 years ago | 0

Answered
replacing element which are <= previous element with NaN
This code may not be efficient for very large vectors. x = [1 2 3 4 3 2 3 4 6 8 5 5 6 8.5 9 11 12 ]; y=movmax(x,[numel(x)...

6 years ago | 0

| accepted

Answered
Change language to english
Your strong language is not necessary and makes people take you much less serious. There is no need for it. To change the langu...

6 years ago | 1

Answered
is NVIDIA RTX 6000 , compatible with Matla R2020a and R2017b?
According to this documentation page: yes. The Quadro RTX 6000 is from the Turing architecture, so it is fully supported on R202...

6 years ago | 0

Answered
how to save/write images using for loop in one .mat file
As Ameer suggests: you should share the code, so we can suggest how you can implement indexing. The point is that your code cur...

6 years ago | 0

Answered
I am having trouble finding the curve fit of an equation in matlab
You're almost there: ln(y) = ln(A) + ln(x) + B*x ln(y) - ln(x) = ln(A) + B*x %so: y2 = ln(y) - ln(x); p = polyfit(x,y2,1)...

6 years ago | 0

| accepted

Answered
How to create a menu using GUI
You can use the uicontrol style text to create a block of text. Then make a callback function for a key press. In that callback ...

6 years ago | 0

| accepted

Answered
How can I find the centroid of this circle of objects?
There are at least two options here. The first is to take the average of the x coordinates and y coordinates of the white pixels...

6 years ago | 0

Answered
for loop not working
Then you are stuck with first undoing that mistake. You should convert those coordinate variables to a single array. You can use...

6 years ago | 0

Answered
how to recived input user in matlab
You need to specify that you want the result as a char array: str=input('enter the string>>','s'); It is also a good idea to d...

6 years ago | 1

| accepted

Answered
How to skip lines to execute/run?
You should be using strcmp to compare strings or chars, but otherwise what you describe is exactly what you need to do (well, on...

6 years ago | 0

Load more