Answered
Having trouble with "Index exceeds the number of array elements (1)" error
The error occur in the line M=line([0,L1*cosd(angt1r(k)),x(k)],[0,L1*sind(angt1r(k)),y(k)]); Here the variables angt1r, x ...

7 years ago | 1

| accepted

Answered
Example for marine vessel energy system
There was a similar question a couple of weeks ago. See my answer. On my system open_system('pe_marine_electrical_system'); w...

7 years ago | 0

| accepted

Answered
Undefined function or variable 'profile'.
Documentation says: MATLAB® Compiler™ supports the full MATLAB language and almost all toolboxes based on MATLAB except: Mos...

7 years ago | 1

| accepted

Answered
how to find the square of the number
This produces something that is close to the result you want %% x(:,3)=[2;3;4;5;6]; len = size(x,1); y = nan( len-1, 1 ); f...

7 years ago | 0

| accepted

Answered
How to create a login interaface with a mask password
Search the FileExchange for password gui and see Get Authentication and Password & spinner controls in Matlab GUI

7 years ago | 0

| accepted

Answered
Not enough input arguments
abs and max are Matlab functions, which requires input. Thus disp(abs) disp(max) are wrong. What did you intend?

7 years ago | 0

Answered
Matlab floating point problem
The script %% x = rotx(45*pi/180)*[1 2 3]'; y = rotx(-45*pi/180)*x; is1 = abs((y-[1;2;3])<eps(10)) returns is1 = 1 ...

7 years ago | 0

Answered
I need a Wind turbine simulation model using Statcom and grid connection. Is there anyone to help me out?
Search the File Exchange for wind turbine simulink

7 years ago | 0

| accepted

Answered
Extract some data from a cell
This typically happend when reading a text file with textscan. A simple solution is to insert datelist = datelist{1}; before...

7 years ago | 0

| accepted

Answered
joining string variables in a table with strjoin and rowfun
Replace rowfun(@(aa, bb) {strjoin({aa,bb}, '_')}, T, 'InputVariables', {'b', 'c'}) by rowfun( @(aa,bb) {strjoin([aa,bb],'_')}...

7 years ago | 0

Answered
How to get the sum of numbers below a desired number in sets?
"data is very big" How big is that? Does it fit in the memory? Test this function function b = cssm( a ) %{ b =...

7 years ago | 1

Answered
How to qpsk a text file containing hexadecimal data of an image
See comm.QPSKModulator System object

7 years ago | 0

Answered
how to menchester encode or qpsk a text file
Replacing LoRa_Menchester_Decoding(menchester_output); by Menchester_Decoding(menchester_output); makes the code run withou...

7 years ago | 1

| accepted

Answered
Where to get tutorial models
I copied and run your statement. After a few seconds the Simulink window with the model appeared. I'm at a university and Mat...

7 years ago | 0

Answered
Take the nanmean of every four points in a dataset.
"I need to get hourly averages of this [15-min] data set which also contains nans" Old time approach %% data_set = randn(109,...

7 years ago | 0

Answered
multiply specific column of a matrix by specific element
>> A = [1 2 3; 4 5 6; 7 8 9]; >> A(:,2) = A(:,2)*2 A = 1 4 3 4 10 6 7 16 9 >> And se...

7 years ago | 1

Answered
How can I adapt a summation function (see below) with a for loop to create a "x to the power of n" function without using the "^" operator?
Try function [answer] = raised(x,n) answer = 1; for ii = 1:n answer = answer * x; end end and test >...

7 years ago | 1

Answered
I know this is an invalid expression on line 9. How can I correct this error? Also, what error is this exactly? Matlab displayed multiple possibilities when trying to correct it.
Replace case (3 5 7) by case {3,5,7} With curly brackets "what error is this" It's break the switch-case-otherwise syn...

7 years ago | 1

| accepted

Answered
I have a 9x1253 matrix: i found the max values of this matrix, but i need to find what row and column they belong to and show that.
See the subsection Largest Element in Matrix of https://se.mathworks.com/help/matlab/ref/max.html In response to comment...

7 years ago | 0

Answered
Why is my GUI program producing an error when I 'Run' it
The error message states that the function plotchar isn't found. >> plotchar 'plotchar' requires Character Recognition Exampl...

7 years ago | 1

| accepted

Answered
My code works as a script file but produces errors as a GUI function, how do I fix it?
One observation sortKey = sort(numKey); ... x = find(numKey ~= sortKey); x2 = x([2,1]); x will be empty if numkey is alread...

7 years ago | 0

| accepted

Answered
preallocate array without initializing
Try this >> A(100,100) = 0; >> whos A Name Size Bytes Class Attributes A 100x100 ...

7 years ago | 0

Answered
How to specify the output type of an fread(fid...) ?
Try this little experiment (based on the first example in the doc) %% fid = fopen('nine.bin','w'); fwrite(fid,[1:9]); fclose...

7 years ago | 1

| accepted

Answered
MATLAB has encountered an internal problem and needs to close
Shit happens! If this problem is reproducible, please submit a Service Request via: http://www.mathworks.com/support/con...

7 years ago | 0

Answered
What is the advantage of fliplr, flipud?
YMMV higher level; easier to read and remember fliplr is faster for large vectors (R2018a)

7 years ago | 2

Answered
How to generate text file in specific path
Replace fid = fopen('DataS1_ch_count_E.txt','w'); by filespec = fullfile( path_named_in_variable, 'DataS1_ch_count_E.txt' ); ...

7 years ago | 0

Answered
How to insert fieldname character type into struct type?
A tiny experiment >> s.f = {1,2,3,4,5,6,7}; >> name = 'f'; >> s.(name)(6) ans = 1×1 cell array {[6]} >> I'm guess...

7 years ago | 0

| accepted

Answered
exist(x,'dir') slow for unavailable network drives
I use exist(x,'dir') to check existence of a directory x. What's the value of x ? Did you mean to run num = exist( 'x:\', '...

7 years ago | 0

Answered
How to replace part of string of cell array inside for loop
A slightly different approach %% File_name_i = string.empty(5,0); for j=1:5 File_name_i(j,1)=string(sprintf('%s%u%s','Fi...

7 years ago | 0

| accepted

Load more